add option to skip check

This commit is contained in:
Balakrishnan Balasubramanian 2024-02-19 11:25:04 -05:00
parent b8ff856fd8
commit ba65b7fb49

View File

@ -1,6 +1,12 @@
#!/bin/sh #!/bin/sh
if test -n "$SKIP_GIT_HOOK_STAGED_CHECK"
then
exit
fi
case $GIT_INDEX_FILE in case $GIT_INDEX_FILE in
*.lock) *.lock)
if GIT_INDEX_FILE=${GIT_INDEX_FILE%.lock} git status --porcelain | grep '^M' 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 "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 "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 "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 exit 1
fi fi
;; ;;