| 1 | #!/usr/bin/env bash |
| 2 | # |
| 3 | # Usage: check-files-in-git.sh /path/to/libwacom/ |
| 4 | |
| 5 | if [ -z "$top_srcdir" ]; then |
| 6 | top_srcdir="$1" |
| 7 | fi |
| 8 | if [ -z "$top_srcdir" ]; then |
| 9 | echo "Usage: `basename $0` /path/to/libwacom" |
| 10 | exit 1 |
| 11 | fi |
| 12 | |
| 13 | export GIT_DIR="$top_srcdir/.git"; |
| 14 | if ! git ls-files >& /dev/null; then |
| 15 | echo "Not a git tree. Skipping" |
| 16 | exit 77 |
| 17 | fi |
| 18 | |
| 19 | pushd "$top_srcdir" > /dev/null |
| 20 | for file in data/*.tablet data/*.stylus data/layouts/*.svg; do |
| 21 | git ls-files --error-unmatch "$file" &> /dev/null || ( |
| 22 | echo "ERROR: File $file is not in git" && test); |
| 23 | rc="$(($rc + $?))"; |
| 24 | done |
| 25 | popd > /dev/null |
| 26 | exit $rc |