adds pre-commit hook

gh-pages
Moisés Guimarães 2016-05-01 09:27:12 -03:00
parent 7297310498
commit 1ee485dee3
1 changed files with 22 additions and 0 deletions

22
pre-commit.sh 100755
View File

@ -0,0 +1,22 @@
#!/bin/sh
#
#
# Our "pre-commit" hook.
# stash modified files not part of this commit, don't test them
echo "\n\nStashing any modified files not part of commit\n\n"
git stash -q --keep-index
# do the commit tests
echo "\n\nRunning commit tests...\n\n"
tox
RESULT=$?
# restore modified files not part of this commit
echo "\n\nPopping any stashed modified files not part of commit\n"
git stash pop -q
[ $RESULT -ne 0 ] && echo "\nOops, your commit failed\n" && exit 1
echo "\nCommit tests passed!\n"
exit 0