Created
December 12, 2012 01:39
-
-
Save pentaho-nbaker/4264108 to your computer and use it in GitHub Desktop.
pre-commit hook for Mondrian Git repositories
This file contains 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/sh | |
ROOT_DIR=$(git rev-parse --show-toplevel) | |
Err=0 | |
for file in $(git diff-index --name-only --diff-filter=ACM --cached HEAD -- | grep -p '\.java$'); do | |
if ${ROOT_DIR}/bin/checkFile.sh $file 2>&1 | grep '.*' ; then | |
Err=1 | |
fi | |
done | |
exit ${Err} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Save this file as "pre-commit" in the .git/hooks directory of the Mondrian repository. You'll need to grant it execute permissions.
Whenever you commit a file ending in .java, it will first check it with the Awesome checkFile utility. Errors should display in the console if there's an issue with one of the classes being committed.