In some situation I want to not have the .git hooks to fire when I am committing a change e.g. prepare-commit-msg
Is there a easy way to suppress them via command line (maybe similar to --no-verify)
The best I could do (and at least this does answer the question) is get the parent's command line and look for '-n' or '--no-verify' passed to it.
if ps -o args= $PPID | grep -E -q ' --no-verify| -n | -n$' ; then
: # they skipped the commit-msg hook, so skip this hook too!
else
: # do your hook code here
fi
I'm sure there's better code out there, I just could NOT find any examples!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With