Skip to content

Commit f19b1c8

Browse files
committed
hooks/precommit: Use a trap to pop the Git stash.
1 parent 14c23cf commit f19b1c8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

hooks/precommit

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
echo "$(date -R): Stashing unrelated changes in Git..."
99
git stash -q --keep-index
1010

11+
trap 'echo "$(date -R): Reverting Git stash..."; git stash pop -q' EXIT
12+
1113
# Only run tests if our rulesets have been changed.
1214
RULESET_PATTERN="src/chrome/content/rules/"
1315
CHANGED_RULESETS="$(git diff --cached --name-only | grep $RULESET_PATTERN)"
@@ -27,7 +29,4 @@ else
2729
"$RULESET_PATTERN."
2830
fi
2931

30-
echo "$(date -R): Reverting Git stash..."
31-
git stash pop -q
32-
3332
exit $RESULT

0 commit comments

Comments
 (0)