Use if instead of && in git hooks (#680)

This prevents a Git hook from issuing a non-zero exit status if the condition is the last line of the hook.
This commit is contained in:
Marek Suscak 2020-12-09 15:53:29 +01:00 committed by GitHub
parent de02da4fc6
commit 2a59c1890f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View file

@ -1,6 +1,9 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-checkout
[ -f "$local_hook" ] && . "$local_hook"
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &

View file

@ -1,6 +1,9 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-commit
[ -f "$local_hook" ] && . "$local_hook"
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &

View file

@ -1,6 +1,9 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-merge
[ -f "$local_hook" ] && . "$local_hook"
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &