Fix pre-commit, prepare-commit-msg hooks

For users who had not overridden the `pre-commit` or
`prepare-commit-msg` Git hooks,
they would see `git commit` hang,
with nothing happening.

The command would exit without going to their editor.

The bug was introduced in d7f194f94e
and the fix is to return a 0 exit code when the override is not present.
This commit is contained in:
Brandon Cordell 2014-12-04 22:23:30 -05:00 committed by Dan Croak
parent d7f194f94e
commit cfcb8497bf
2 changed files with 8 additions and 2 deletions

View file

@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/pre-commit local_hook="$HOME"/.git_template.local/hooks/pre-commit
[ -f "$local_hook" ] && . "$local_hook"
if [ -f "$local_hook" ]; then
. "$local_hook"
fi

View file

@ -1,4 +1,7 @@
#!/bin/sh #!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/prepare-commit-msg local_hook="$HOME"/.git_template.local/hooks/prepare-commit-msg
[ -f "$local_hook" ] && . "$local_hook"
if [ -f "$local_hook" ]; then
. "$local_hook"
fi