diff options
author | Alex Richardson <arichardson@FreeBSD.org> | 2021-01-07 14:00:32 +0000 |
---|---|---|
committer | Alex Richardson <arichardson@FreeBSD.org> | 2021-01-07 14:00:32 +0000 |
commit | d146f831801f226802e3e1d55bec2cfbea9dc577 (patch) | |
tree | 2122bfa5be2f9808f2669a11a099db1900d6d5de | |
parent | b500c184b6569ff2443bd9d0e3697fafdb2e47ac (diff) |
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
-rwxr-xr-x | tools/tools/git/hooks/prepare-commit-msg | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg index e453b73cc45d..51b92a10724d 100755 --- a/tools/tools/git/hooks/prepare-commit-msg +++ b/tools/tools/git/hooks/prepare-commit-msg @@ -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" |