documentation-file-ref-check 395 B

123456789101112131415
  1. #!/bin/sh
  2. # Treewide grep for references to files under Documentation, and report
  3. # non-existing files in stderr.
  4. for f in $(git ls-files); do
  5. for ref in $(grep -ho "Documentation/[A-Za-z0-9_.,~/*+-]*" "$f"); do
  6. # presume trailing . and , are not part of the name
  7. ref=${ref%%[.,]}
  8. # use ls to handle wildcards
  9. if ! ls $ref >/dev/null 2>&1; then
  10. echo "$f: $ref" >&2
  11. fi
  12. done
  13. done