git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] templates: clarify SHA1 arg in prepare-commit-msg

From
MGmataha via GitGitGadget <gitgitgadget@gmail.com>
Date
May 18, 2022, 18:40 UTC
Message-ID
<pull.1265.git.git.1652899219597.gitgitgadget@gmail.com>
From: mataha <mateusz.kazimierczuk@xolv.io>

'prepare-commit-msg' hook sample description doesn't mention the third argument (a commit object name) nor when is it actually passed to that hook by git-commit (if the source is a commit; see builtin/commit.c#L777, sequencer.c#L1219). Seeing that it's documented in githooks(5), there should be no reason not to include that in the sample hook as well.

Signed-off-by: Mateusz 'mataha' Kazimierczuk <mateusz.kazimierczuk@xolv.io>
---
    Mention the third argument in 'prepare-commit-msg' hook sample
    
    'prepare-commit-msg' hook sample doesn't mention what the third argument
    is for nor when is it actually passed; I feel like it should be, for the
    sake of convenience (this doesn't mean that a user shouldn't refer to a
    more detailed description in the manual, of course).
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1265%2Fmataha%2Fdoc%2Fprepare-commit-msg-args-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1265/mataha/doc/prepare-commit-msg-args-v1
Pull-Request: https://github.com/git/git/pull/1265
 templates/hooks--prepare-commit-msg.sample | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/templates/hooks--prepare-commit-msg.sample b/templates/hooks--prepare-commit-msg.sample
index 318afe3fd86..bc06d0701a8 100755
--- a/templates/hooks--prepare-commit-msg.sample
+++ b/templates/hooks--prepare-commit-msg.sample
@@ -3,9 +3,9 @@
 # An example hook script to prepare the commit log message.
 # Called by "git commit" with the name of the file that has the
 # commit message, followed by the description of the commit
-# message's source.  The hook's purpose is to edit the commit
-# message file.  If the hook fails with a non-zero status,
-# the commit is aborted.
+# message's source and the commit object name (if the source was
+# a commit).  The hook's purpose is to edit the commit message file.
+# If the hook fails with a non-zero status, the commit is aborted.
 #
 # To enable this hook, rename this file to "prepare-commit-msg".
 

base-commit: 277cf0bc36094f6dc4297d8c9cef79df045b735d
-- 
gitgitgadget
Next: Junio C Hamano
Message 1 of 2 in “templates: clarify SHA1 arg in prepare-commit-msg”
  1. templates: clarify SHA1 arg in prepare-commit-msgmataha via GitGitGadget, May 18, 2022
  2. Junio C HamanoMay 18, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.