DEV: Adds stashing to pre-commit hook.

So that the code that is linted/tested is only the staged commits.
Useful when editing by only staging parts of files via git.
This commit is contained in:
Eddie Hebert
2013-03-20 11:00:38 -04:00
parent 8bf4c60169
commit 060b565cdc
+10
View File
@@ -13,7 +13,17 @@
set -e
# stash everything that wasn't just staged
# so that we are only testing the staged code
git stash -q --keep-index
# Run flake8 linting
flake8 zipline tests
# Run unit tests
nosetests -x
# restore unstaged code
# N.B. this won't run if linting or unit tests fail
# But if either fail, it's probably best to have only the offending
# staged commits 'active', anyway.
git stash pop -q