From ba65b7fb49a513f23d80d33e394ead5928616d29 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Mon, 19 Feb 2024 11:25:04 -0500 Subject: [PATCH] add option to skip check --- pre-commit-staged-check.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pre-commit-staged-check.sh b/pre-commit-staged-check.sh index a6b2760..2e90285 100755 --- a/pre-commit-staged-check.sh +++ b/pre-commit-staged-check.sh @@ -1,6 +1,12 @@ #!/bin/sh +if test -n "$SKIP_GIT_HOOK_STAGED_CHECK" +then + exit +fi + + case $GIT_INDEX_FILE in *.lock) if GIT_INDEX_FILE=${GIT_INDEX_FILE%.lock} git status --porcelain | grep '^M' @@ -8,6 +14,7 @@ case $GIT_INDEX_FILE in echo "Error: Found both staged and unstaged changes when trying to commit with 'git commit -a'." echo "Do two seperate commits with, 'git commit -m ...' and 'git commit -a -m ...'" echo "Or 'git reset .' and then 'git commit -a -m ...' for a single commit" + echo "SKIP_GIT_HOOK_STAGED_CHECK=yes or --no-verify to skip check" exit 1 fi ;;