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

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

From
Paolo Bonzini <bonzini@gnu.org>
Date
Jan 21, 2008, 06:16 UTC
Message-ID
<479438D1.2050107@gnu.org>
In-Reply-To
<7vd4rw6siv.fsf@gitster.siamese.dyndns.org>
Show 6 quoted lines
> I think that the approach has one huge advantage.  Commands
> other than "git commit" itself ("git merge", "git rebase", "git
> am", etc.) do call "git commit" to record the changes they made.
> I suspect these command would not want this template behaviour,
> and not adding this custom commit message "feature" to "git
> commit" would avoid the risk of breaking them.

My patch does not do that. Of all these commands, only git-rebase uses porcelain git-commit rather than plumbing git-commit-tree, and it uses the -C or -F options (which disable the hook in my patch).

> At the same time, this exact issue could be a drawback.  Some of
> them _might_ want it.  But in that case, the the custom template
> "hook" needs to be told _why_ it is being called, so that it can
> adjust its behaviour.
I would like to understand why both of you have not considered the point 
  that the script would need the updated index from git-commit.  Because 
short of reusing half of the old Bourne-shell git-commit, I don't see 
how this would be possible, but maybe there's something obvious.  Or 
maybe we need new plumbing like git-build-index -- then I'd still need 
to complicate my script to build a template commit message, but I 
wouldn't need to muddle myself (not too much at least) in handling the 
command line.
Paolo
Previous: Junio C HamanoNext: Johannes Schindelin
Message 18 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.