Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Jun 2021 12:04:16 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: aa2e78813048 - 2021Q2 - .hooks/prepare-commit-msg: Enhance commit-msg hook.
Message-ID:  <202106041204.154C4G5E027838@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=aa2e788130488c99c8730f6b181ac73a87a9dade

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

    .hooks/prepare-commit-msg: Enhance commit-msg hook.
    
    If a single port is updated, the hook now pre-fills in an appropriate
    subject line.
    
    (cherry picked from commit 5147b3b5e10fcd48d3679bd0e7b261f345440881)
---
 .hooks/prepare-commit-msg | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/.hooks/prepare-commit-msg b/.hooks/prepare-commit-msg
index 88440fee43cc..00c27a46c36d 100755
--- a/.hooks/prepare-commit-msg
+++ b/.hooks/prepare-commit-msg
@@ -28,6 +28,25 @@ esac
 outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX)
 exec 3> "$outfile"
 
+if [ -z "$3" ]
+then
+  what=$(git diff-index --name-only --cached --diff-filter=ACMR HEAD|sed -Ee 's/^([^\/]+\/[^\/]+).*/\1/'|sort -u|xargs)
+
+  case $what in
+    *\ *)
+      # More than one port, do nothing
+      ;;
+    *)
+      # One port, prepare the commit message.
+      {
+	echo "# Uncomment and add a short description of why things changed."
+	echo "# $what: "
+	echo
+      } >&3
+      ;;
+esac
+fi
+
 # Create a commit message template from three parts:
 #
 # 1. The beginning of the git-provided template (up to the first comment-only



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