From owner-dev-commits-src-main@freebsd.org Wed Dec 30 17:33:31 2020 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 206D34C9B1B; Wed, 30 Dec 2020 17:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D5dfz0QZbz3wQB; Wed, 30 Dec 2020 17:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 015C721F10; Wed, 30 Dec 2020 17:33:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BUHXU6U053610; Wed, 30 Dec 2020 17:33:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BUHXUka053609; Wed, 30 Dec 2020 17:33:30 GMT (envelope-from git) Date: Wed, 30 Dec 2020 17:33:30 GMT Message-Id: <202012301733.0BUHXUka053609@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b67e44075539 - main - Add comment explaining Git commit message hook MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b67e440755391b4a75363173ca16e170ccbf0394 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for the main branch of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Dec 2020 17:33:31 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b67e440755391b4a75363173ca16e170ccbf0394 commit b67e440755391b4a75363173ca16e170ccbf0394 Author: Ed Maste AuthorDate: 2020-12-30 17:31:29 +0000 Commit: Ed Maste CommitDate: 2020-12-30 17:33:19 +0000 Add comment explaining Git commit message hook Suggested by: jhb --- tools/tools/git/hooks/prepare-commit-msg | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/tools/git/hooks/prepare-commit-msg b/tools/tools/git/hooks/prepare-commit-msg index 9dcb85cd1a3f..e453b73cc45d 100755 --- a/tools/tools/git/hooks/prepare-commit-msg +++ b/tools/tools/git/hooks/prepare-commit-msg @@ -1,5 +1,13 @@ #!/bin/sh +# prepare-commit-msg: Prepare a commit message upon `git commit` for the +# user to edit. A script (rather than a static template) is used, so +# that we can insert our template text other than at the top of the +# message. +# +# Install by copying into the git hooks directory - for example, +# cp tools/tools/git/hooks/prepare-commit-msg .git/hooks/ + case "$2" in commit|message) # It appears git invokes this script for interactive rebase but does @@ -21,7 +29,9 @@ outfile=$(mktemp /tmp/freebsd-git-commit.XXXXXXXX) # # 1. The beginning of the git-provided template (up to the first comment-only # line) which explains commented lines and such. +# # 2. Our template. +# # 3. The remainder of the git-provided template (from the first comment-only # line to the end of the file) which lists files staged for commit, files # not staged, and untracked files.