Skip to content

Commit fe287e4

Browse files
committed
Remove git stash from pre-commit hook
1 parent 658419d commit fe287e4

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,9 @@ ln -s ../../pre-commit.sh .git/hooks/pre-commit
112112
```
113113
114114
This will only allow commits if the tests pass. It is also a good reminder to keep the test suite
115-
short.
115+
short.
116+
117+
Note: the tests run on the current state of the working directory. I tried to add a `git stash` in
118+
the script to only test what's actually being committed, but I couldn't get it to run reliably
119+
(it's still in there but commented). Keep this in mind when you commit, and don't forget to re-add
120+
the changes if the first attempt failed and you fixed the tests.

pre-commit.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#!/usr/bin/env bash
22

3-
STASH_NAME="pre-commit-$(date +%s)"
4-
git stash save --keep-index $STASH_NAME
3+
# STASH_NAME="pre-commit-$(date +%s)"
4+
# git stash save --keep-index $STASH_NAME
55

66
mvn clean test
77
RESULT=$?
88

9-
STASHES=$(git stash list)
10-
if [[ $STASHES == *$STASH_NAME* ]]; then
11-
git stash pop
12-
fi
9+
# STASHES=$(git stash list)
10+
# if [[ $STASHES == *$STASH_NAME* ]]; then
11+
# git stash pop
12+
# fi
1313

1414
[ $RESULT -ne 0 ] && exit 1
1515
exit 0

0 commit comments

Comments
 (0)