Thread (9 messages) flat view 9 messages, 3 authors, 2021-08-05

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

From: Taylor Blau <hidden>
Date: 2021-08-03 22:08:00

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help