Advertisement
dflima

pre-commit hook

Nov 21st, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php`
  4.  
  5. SFILES=${FILES:-$FILES}
  6.  
  7. echo "Running PHP Lint"
  8. for FILE in $SFILES
  9. do
  10.     php -l -d display_errors=0 $FILE
  11.     if [ $? != 0 ]
  12.     then
  13.         echo "Fix the errors"
  14.         exit 1
  15.     fi
  16. done
  17.  
  18. exit 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement