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

Re: [PATCHv3] builtin/merge: honor commit-msg hook for merges

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 21, 2017, 01:10 UTC
Message-ID
<xmqqy3p8n9fe.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79kaN4nKwGXq9t+Lv9e4X6qkBUAj4S8gofrNj3VZYw1sv+w@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> I'll send a patch fixing the docs, though with this thought, maybe we need
> to fix other commands, that produce commits as well?
> (git revert, others?)

I do not think "commands that create commits" is not a good criteria. "git notes" and "git stash" would (internally) create a commit while recording a new change, but you obvously would not want these hooks to kick in.

A command that can stop in the middle and to which running "git commit" is how the end-user concludes the operation would be a candidate. "git merge X", "git cherry-pick A", and "git cherry-pick A..B" may be good candidates.

For "rebase" and others that have the "convenience --continue" option that make a commit before continuing, I would think that we should treat these as invoking "git commit". That is, when these commands stop and you resolve the conflict in the index and in the working tree, the next "git $cmd --continue" you type is merely a way to let you be lazy. You'd be typing "git commit && git $cmd --continue" if you were to refuse the lazy convenience option and want to spell out what you are doing explicitly, and you'd get the same result as you'd get from just "git $cmd --continue" if you did so.

On the other hand, "git am" is not a candidate. You never use "git commit" to mark that you are done, even if you refuse to use the lazy convenience option and spell out what you are doing explicitly.

Previous: Stefan BellerNext: Stefan Beller
Message 17 of 19 in “builtin/merge: honor commit-msg hook for merges”
  1. builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 5, 2017
  2. Junio C HamanoSep 5, 2017
  3. parse-options: warn developers on negated optionsStefan Beller, Sep 5, 2017
  4. Junio C HamanoSep 6, 2017
  5. Junio C HamanoSep 6, 2017
  6. Stefan BellerSep 6, 2017
  7. Junio C HamanoSep 6, 2017
  8. [PATCHv2] builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 5, 2017
  9. Junio C HamanoSep 6, 2017
  10. Stefan BellerSep 6, 2017
  11. Junio C HamanoSep 6, 2017
  12. [PATCHv3] builtin/merge: honor commit-msg hook for mergesStefan Beller, Sep 7, 2017
  13. Junio C HamanoSep 8, 2017
  14. Stefan BellerSep 11, 2017
  15. Kaartic SivaraamSep 16, 2017
  16. Stefan BellerSep 20, 2017
  17. Junio C HamanoSep 21, 2017
  18. Documentation/githooks: mention merge in commit-msg hookStefan Beller, Sep 21, 2017
  19. Junio C HamanoSep 22, 2017

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.