diff options
Diffstat (limited to 'bin/git-pre-commit-hook')
| -rwxr-xr-x | bin/git-pre-commit-hook | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/git-pre-commit-hook b/bin/git-pre-commit-hook new file mode 100755 index 00000000..81ace2cd --- /dev/null +++ b/bin/git-pre-commit-hook @@ -0,0 +1,17 @@ +#!/bin/bash + +# copy (DO NOT SYMLINK) this file to .git/hooks/pre-commit +# to check style on all modified files before allowing the commit to complete +# +# DO NOT SYMLINK +# DO NOT SYMLINK +# DO NOT SYMLINK (why? security risk) + +cd $(dirname "$0")/../.. + +errors=$(git diff --cached | bin/style-check --diff 2>&1) + +if [ "$?" != "0" ]; then + echo "$errors" + exit 1 +fi |
