summaryrefslogtreecommitdiff
path: root/bin/git-pre-commit-hook
diff options
context:
space:
mode:
authorLex Neva <lexelby@users.noreply.github.com>2024-10-25 08:03:14 -0400
committerGitHub <noreply@github.com>2024-10-25 08:03:14 -0400
commitd5313b1f92378697ec08d6d1d2833b64492ce435 (patch)
treebc9105606a7b5f244138f628a6f46b16aea080c6 /bin/git-pre-commit-hook
parent4e6fd162cde77cfc7a50f22170290e580164c484 (diff)
make hook actually cancel the commit (#3235)
Diffstat (limited to 'bin/git-pre-commit-hook')
-rwxr-xr-xbin/git-pre-commit-hook9
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/git-pre-commit-hook b/bin/git-pre-commit-hook
index 4d81c5a7..e5a2d201 100755
--- a/bin/git-pre-commit-hook
+++ b/bin/git-pre-commit-hook
@@ -19,6 +19,13 @@ check_errors() {
cd $(dirname "$0")/../..
check_errors git stash --keep-index
-check_errors git diff --cached | bin/style-check 2>&1
+
+errors="$(git diff --cached | bin/style-check 2>&1)"
+status=$?
+if [ "$status" != "0" ]; then
+ echo "$errors"
+fi
+
check_errors git stash pop
+exit $status