1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#!/bin/bash # Do we have whitespace errors? files=$(git diff --cached --name-only) for file in $files do perl tools/checknl.pl $file 1>/dev/null if [[ $? -ne 0 ]] then echo "** Failed to commit" echo "** Whitespace error in $file" exit 1 fi done