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

Re: [RFC/PATCH] merge: honor prepare-commit-msg hook

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 22, 2010, 00:14 UTC
Message-ID
<7vsk3cgyob.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1279600144-89629-1-git-send-email-jaysoffian@gmail.com>
Jay Soffian <jaysoffian@gmail.com> writes:
> ---
> I couldn't figure out why my prepare-commit-msg wasn't being honored
> by git merge.
It has been that way from day one, it appears.

The bypassing of pre-commit hook was and remains to be a conscious design decision. When you are pulling from your contributors who may have objectionable contents that you have to merge, the damage is already done; you _could_ yell at them to fix their branch and re-pull in theory, but that wouldn't work very well in practice.

On the other hand, I think letting people use prepare-commit-msg for merges might make sense. Indeed, "git commit" is prepared to call prepare-commit-msg telling the hook that it is concluding a merge, when your "git merge" stopped due to a conflict (or you stopped it from making a new commit with --no-commit).

I don't know about the other hooks "git commit" normally calls. Both "commit-msg" and "post-commit" may make sense, but I don't care too deeply either way---I don't care too deeply for pre-commit either ;-).

Previous: Jay Soffian
Message 2 of 2 in “merge: honor prepare-commit-msg hook”
  1. merge: honor prepare-commit-msg hookJay Soffian, Jul 20, 2010
  2. Junio C HamanoJul 22, 2010

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.