github.com/vlifesystems/rulehunter@v0.0.0-20180501090014-673078aa4a83/git-hooks/pre-commit (about) 1 #!/bin/sh 2 3 # Redirect output to stderr. 4 exec 1>&2 5 # enable user input 6 exec < /dev/tty 7 8 todoRegexp='^\+.*TODO' 9 10 if test $(git diff --cached | grep $todoRegexp | wc -l) != 0 11 then 12 exec git diff --cached | grep -ne $todoRegexp 13 echo 14 read -p "There are new TODO comments in your modifications. Are you sure want to continue? (y/n)" yn 15 echo $yn | grep ^[Yy]$ 16 if [ $? -eq 0 ] 17 then 18 exit 0; # Yes 19 else 20 exit 1; # No 21 fi 22 fi