summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/git-pre-commit-hook17
1 files changed, 12 insertions, 5 deletions
diff --git a/bin/git-pre-commit-hook b/bin/git-pre-commit-hook
index 81ace2cd..4d81c5a7 100755
--- a/bin/git-pre-commit-hook
+++ b/bin/git-pre-commit-hook
@@ -7,11 +7,18 @@
# DO NOT SYMLINK
# DO NOT SYMLINK (why? security risk)
+check_errors() {
+ errors="$("$@")"
+
+ if [ "$?" != "0" ]; then
+ echo "$errors"
+ exit 1
+ fi
+}
+
cd $(dirname "$0")/../..
-errors=$(git diff --cached | bin/style-check --diff 2>&1)
+check_errors git stash --keep-index
+check_errors git diff --cached | bin/style-check 2>&1
+check_errors git stash pop
-if [ "$?" != "0" ]; then
- echo "$errors"
- exit 1
-fi