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

Re: [PATCH] git-commit: add a prepare-commit-msg hook

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jan 18, 2008, 21:08 UTC
Message-ID
<20080118210825.GB3411@steel.home>
In-Reply-To
<47910229.90700@gnu.org>
Paolo Bonzini, Fri, Jan 18, 2008 20:46:49 +0100:
Show 11 quoted lines
> Alex Riesen wrote:
>> Paolo Bonzini, Fri, Jan 18, 2008 15:51:25 +0100:
>>> +		if (!edit_message) {
>>> +			run_hook(index_file, "prepare-commit-msg", git_path(commit_editmsg));
>>> +		}
>>>  		launch_editor(git_path(commit_editmsg), NULL, env);
>> "preedit-new-commit-msg", perhaps. A "prepare-" suggests it is called
>> every time, even if no editor is specified, which it is not.
>> And it really does look like a template...
>
> It is, but quite a powerful one. :-)

Except that "template" is already taken. Someone uses it and some may even got used to "template" having that meaning.

> template-commit-msg?

Not really. It will be run even if the template (the one Git have already) is not used.

It really looks a bit complicated. If at all, how about running that "pre-editor" hook with information about where the message comes from?

I.e. if the message comes from a template:
    preedit-commit-msg .git/COMMIT_MSG template
or, for a message coming from commit:
    preedit-commit-msg .git/COMMIT_MSG commit 0123456789abdef
or, for a message coming from a file
    preedit-commit-msg .git/COMMIT_MSG file user/path/to/file
and finally, for a new message:
    preedit-commit-msg .git/COMMIT_MSG
?
Previous: Paolo BonziniNext: Junio C Hamano
Message 11 of 23 in “git-commit: add a prepare-commit-msg hook”
  1. git-commit: add a prepare-commit-msg hookPaolo Bonzini, Jan 18, 2008
  2. Johannes SchindelinJan 18, 2008
  3. Paolo BonziniJan 18, 2008
  4. Johannes SchindelinJan 18, 2008
  5. Paolo BonziniJan 18, 2008
  6. Johannes SchindelinJan 18, 2008
  7. Paolo BonziniJan 18, 2008
  8. Benoit SigoureJan 18, 2008
  9. Alex RiesenJan 18, 2008
  10. Paolo BonziniJan 18, 2008
  11. Alex RiesenJan 18, 2008
  12. Junio C HamanoJan 18, 2008
  13. Paolo BonziniJan 19, 2008
  14. Johannes SchindelinJan 19, 2008
  15. Benoit SigoureJan 19, 2008
  16. Paolo BonziniJan 19, 2008
  17. Junio C HamanoJan 20, 2008
  18. Paolo BonziniJan 21, 2008
  19. Johannes SchindelinJan 21, 2008
  20. Paolo BonziniJan 21, 2008
  21. Johannes SchindelinJan 21, 2008
  22. Paolo BonziniJan 21, 2008
  23. Junio C HamanoJan 21, 2008

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.