Skip to content

Instantly share code, notes, and snippets.

@pentaho-nbaker
Created December 12, 2012 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pentaho-nbaker/4264108 to your computer and use it in GitHub Desktop.
Save pentaho-nbaker/4264108 to your computer and use it in GitHub Desktop.
pre-commit hook for Mondrian Git repositories
#!/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}
@pentaho-nbaker
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment