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

Re: Why git-revert doesn't invoke the pre-commit and the commit-msg hooks?

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 20, 2018, 18:00 UTC
Message-ID
<xmqqfu5v4k4c.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<7ff6079d-5834-3bbd-781b-a2fc0659e7e5@talktalk.net>
Phillip Wood <phillip.wood@talktalk.net> writes:
> ... I'm worried though that
> someone out there is scripting with a non-interactive editor which may
> break if we start verifying the message ...

This is a very valid concern. Making sure that 'revert' pays attention to the --verify option when given from the command line, without changing the default or anything else, would satisfy everybody's wish, I would think. It won't bother existing users, and in addition will now give an option to people to selectively run pre-whatever hook when they choose to.

I am not sure if we should be running pre-commit/commit-msg for revert. The message and the effect of revert is quite distinct from the ordinary commit, and it is very likely that people would want to treat them differently. It would make more sense (if we were to add an option to run any hook we currently do not run to the command) to run pre-revert/revert-msg hooks instead, and then people who happen to want to do the same thing in these hooks what they do for ordinary commits can just call their pre-commit/commit-msg hooks from there, perhaps.

Previous: Phillip WoodNext: Gustavo Chaves
Message 4 of 5 in “Why git-revert doesn't invoke the pre-commit and the commit-msg hooks?”
  1. Gustavo ChavesFeb 13, 2018
  2. Gustavo ChavesFeb 19, 2018
  3. Phillip WoodFeb 20, 2018
  4. Junio C HamanoFeb 20, 2018
  5. Gustavo ChavesFeb 21, 2018

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.