summaryrefslogtreecommitdiffstats
path: root/scripts/documentation-file-ref-check
blob: bc1659900e891806d1066a098b484ba481b54932 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# Treewide grep for references to files under Documentation, and report
# non-existing files in stderr.

for f in $(git ls-files); do
	for ref in $(grep -ho "Documentation/[A-Za-z0-9_.,~/*+-]*" "$f"); do
		# presume trailing . and , are not part of the name
		ref=${ref%%[.,]}

		# use ls to handle wildcards
		if ! ls $ref >/dev/null 2>&1; then
			echo "$f: $ref" >&2
		fi
	done
done