Created
September 25, 2012 05:42
-
-
Save dmj/3780185 to your computer and use it in GitHub Desktop.
Git pre-commit, check coding style
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
### $Id:$ | |
### | |
### Pre-commit hook for VuFind2 | |
### | |
### Based on Z-Shell, maybe portable bash or sh. | |
### | |
### $Log:$ | |
### | |
error=0 | |
## Stash all unstaged changes | |
git stash -q --keep-index | |
for FILE in `git diff --cached --name-only | grep ".php$"` | |
do | |
## Check coding style | |
phpcs --standard=PEAR $FILE | |
let "error=$error || $?" | |
done | |
## Unstash unstaged | |
git stash pop -q | |
exit $error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment