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

Re: git revert --continue --no-verify

From
Taylor Blau <me@ttaylorr.com>
Date
Aug 3, 2021, 22:07 UTC
Message-ID
<YQm+PWAtc3rixqsw@nand.local>
In-Reply-To
<CAAVFnNmitHeimogaGUUwWGWhve+wbF6CXcSNUonGCWAgOSKzjA@mail.gmail.com>
On Tue, Aug 03, 2021 at 04:33:09PM -0500, Cameron Steffen wrote:
> Perhaps the issue then is that the pre-commit hook should not run for
> `git revert --continue`? It does not run for `git revert`.

This does look like an oversight to me, but you'll have to bear with me since I am relatively unfamiliar with the sequencer code.

Ultimately `git revert` calls do_pick_commit() which either calls do_commit() or run_git_commit(). A couple of curiosities there:

  - do_commit() does fall back to run_git_commit() if it has the
    VERIFY_MSG bit set in `flags`.
  - run_git_commit() passes `-n` only when VERIFY_MSG *isn't* set, so
    the VERIFY_MSG bit does imply that the pre-commit hook would be run
    there.
  - when do_pick_commit() does have to fall back to run_git_commit(), it
    sets the VERIFY_MSG bit in flags.

But we never end up calling run_git_commit() (except in the case of errors) because do_pick_commit() special-cases `command == TODO_REVERT` (which is the case for `git revert`) and calls `do_commit()`.

But it gets weirder: do_commit() calls run_git_commit() itself, but before the caller in do_pick_commit() has had a chance to add VERIFY_MSG to the flags.

So I suspect that this is an oversight, but perhaps somebody more familiar with this code could confirm my thinking.

Thanks, Taylor

Previous: Cameron SteffenNext: Junio C Hamano
Message 6 of 10 in “git revert --continue --no-verify”
  1. Cameron SteffenAug 3, 2021
  2. Taylor BlauAug 3, 2021
  3. Cameron SteffenAug 3, 2021
  4. Taylor BlauAug 3, 2021
  5. Cameron SteffenAug 3, 2021
  6. Taylor BlauAug 3, 2021
  7. Junio C HamanoAug 4, 2021
  8. Phillip WoodAug 4, 2021
  9. Taylor BlauAug 5, 2021
  10. Cameron SteffenAug 5, 2021

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.