prepare-commit-msg: Avoid warning on macOS and shellcheck fixes

The macOS /bin/sh complains about using return outside of functions.
Replace `return 0` with `exit 0` to fix this. While editing this files
I've also fixed all the shellcheck warnings that were displayed by my IDE.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D28016
This commit is contained in:
Alex Richardson 2021-01-07 14:00:32 +00:00
parent b500c184b6
commit d146f83180

View File

@ -13,13 +13,13 @@ commit|message)
# It appears git invokes this script for interactive rebase but does
# not remove commented lines, so just exit if we're not called with the
# default (comment-containing) template.
egrep -q '^#' "$1" || return 0
grep -E -q '^#' "$1" || exit 0
;;
template)
return 0
exit 0
;;
merge)
return 0
exit 0
;;
esac
@ -58,7 +58,7 @@ $(awk '1;/^#$/{exit}' $1)
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.
$(awk '/^#$/,EOF' $1)
$(awk '/^#$/,EOF' "$1")
EOF
mv $outfile $1
mv "$outfile" "$1"