Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jun 2021 12:04:15 GMT
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org
Subject:   git: d1c97575f0c5 - 2021Q2 - .hooks/prepare-commit-msg: Cleanup.
Message-ID:  <202106041204.154C4FKr027812@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch 2021Q2 has been updated by mat:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d1c97575f0c50b8c18d1958eefb258ba7b176452

commit d1c97575f0c50b8c18d1958eefb258ba7b176452
Author:     Mathieu Arnold <mat@FreeBSD.org>
AuthorDate: 2021-06-04 11:52:18 +0000
Commit:     Mathieu Arnold <mat@FreeBSD.org>
CommitDate: 2021-06-04 12:03:53 +0000

    .hooks/prepare-commit-msg: Cleanup.
    
    Instead of writing everything in the new commit template all at once in
    a large here document, do it cleanly one command at a time.
    
    (cherry picked from commit d744a8de4295aa3ba4fc6caf011743d661d98e29)
---
 .hooks/prepare-commit-msg | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/.hooks/prepare-commit-msg b/.hooks/prepare-commit-msg
index 12f26c74d0b6..88440fee43cc 100755
--- a/.hooks/prepare-commit-msg
+++ b/.hooks/prepare-commit-msg
@@ -26,6 +26,7 @@ merge)
 esac
 
 outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
+exec 3> "$outfile"
 
 # Create a commit message template from three parts:
 #
@@ -38,8 +39,9 @@ outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
 #    line to the end of the file) which lists files staged for commit, files
 #    not staged, and untracked files.
 
-cat >"$outfile" <<EOF
-$(awk '1;/^#$/{exit}' "$1")
+awk '1;/^#$/{exit}' "$1" >&3
+
+cat >&3 <<EOF
 # category/port: Subject goes here, max 50 cols -|
 # <then a blank line>
 #                                                         72 columns --|
@@ -65,7 +67,10 @@ $(awk '1;/^#$/{exit}' "$1")
 #
 # "Pull Request" and "Differential Revision" require the *full* GitHub or
 # Phabricator URL.
-$(awk '/^#$/,EOF' "$1")
 EOF
 
+awk '/^#$/,EOF' "$1" >&3
+
+exec 3>&-
+
 mv "$outfile" "$1"



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