From d5313b1f92378697ec08d6d1d2833b64492ce435 Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Fri, 25 Oct 2024 08:03:14 -0400 Subject: [PATCH] make hook actually cancel the commit (#3235) --- bin/git-pre-commit-hook | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/git-pre-commit-hook b/bin/git-pre-commit-hook index 4d81c5a71..e5a2d201f 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