Staging
v0.5.1
https://github.com/torvalds/linux
Raw File
Tip revision: 1291a0d5049dbc06baaaf66a9ff3f53db493b19b authored by Linus Torvalds on 18 December 2017, 02:59:59 UTC
Linux 4.15-rc4
Tip revision: 1291a0d
documentation-file-ref-check
#!/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
back to top