From 357a404895fd1850bd65365e5c02510cabaa238e Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Fri, 27 May 2022 10:27:19 +0200 Subject: [PATCH] Fix local pre-commit hooks not running --- githooks/pre-commit | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/githooks/pre-commit b/githooks/pre-commit index 53b3fec..58b2598 100755 --- a/githooks/pre-commit +++ b/githooks/pre-commit @@ -58,17 +58,20 @@ case $indentation in ;; esac +if [ -n "$error" ] +then exit 1 +fi + cd $GIT_DIR rm -rf $temp -if [ -z "$error" ] -then exit 0 -else exit 1 -fi - hook=$(basename $0) -if [ -f $GIT_DIR/hooks/$hook ] +if [ -f "$GIT_DIR/hooks/$hook" ] then echo Running project-level hook: $GIT_DIR/hooks/$hook $GIT_DIR/hooks/$hook + error=$? + if [ -n "$error" ] + then exit $error + fi fi