Files
growstuff/script/pre-commit.sh
Miles Gould 15ce32e786 Only stash unindexed changes if there are any.
This allows `git commit --amend` to work properly.
2012-09-10 17:42:29 +01:00

14 lines
365 B
Bash
Executable File

# Git pre-commit hook
# To install, run "rake hooks"
if git diff-index --quiet HEAD --; then
# no changes between index and working copy; just run tests
rspec spec
else
# Test the version that's about to be committed,
# stashing all unindexed changes
git stash -q --keep-index
rspec spec
git stash pop -q
fi