git: d146f831801f - main - prepare-commit-msg: Avoid warning on macOS and shellcheck fixes
Alex Richardson
arichardson at FreeBSD.org
Thu Jan 7 14:01:25 UTC 2021
The branch main has been updated by arichardson:
URL: https://cgit.FreeBSD.org/src/commit/?id=d146f831801f226802e3e1d55bec2cfbea9dc577
commit d146f831801f226802e3e1d55bec2cfbea9dc577
Author: Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-01-07 14:00:32 +0000
Commit: Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-01-07 14:00:32 +0000
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
---
tools/tools/git/hooks/prepare-commit-msg | 10 +++++-----
1 file 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"
More information about the dev-commits-src-main
mailing list