Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jan 2021 14:01:24 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d146f831801f - main - prepare-commit-msg: Avoid warning on macOS and shellcheck fixes
Message-ID:  <202101071401.107E1OXJ039427@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=d146f831801f226802e3e1d55bec2cfbea9dc577

commit d146f831801f226802e3e1d55bec2cfbea9dc577
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-01-07 14:00:32 +0000
Commit:     Alex Richardson <arichardson@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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101071401.107E1OXJ039427>