]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: do not record dropped commits as rewritten
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Tue, 30 Jun 2026 15:29:01 +0000 (16:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 30 Jun 2026 19:03:14 +0000 (12:03 -0700)
commit5f504e6fa9c98fc9052d16f8b5049001612ac302
tree8f794a44230c7ab7fba5003c3bb88f7aafece629
parent853f67b34a53b7269cde19e7f8c86981405ce5da
sequencer: do not record dropped commits as rewritten

If a commit gets dropped because its changes are already upstream
then we should not record it as rewritten. As well as confusing any
post-rewrite hooks this means we end up copying the notes from the
dropped commit to the commit that was picked immediately before the
one that was dropped.

While we do not want to record the dropped commit is rewritten, if
it is the final commit in a chain of fixups then we need to flush
the list of rewritten commits. The behavior of an "edit" command
where the commit is dropped is changed so that "rebase --continue"
will not amend the previous pick. However, as the code comment notes
it will still be erroneously recorded as rewritten when the rebase
continues. That will need to be addressed separately along with not
recording skipped commits as rewritten.

The initialization of "drop_commit" is moved to ensure it is initialized
when rewording a fast-forwarded commit.

Reported-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3400-rebase.sh
t/t5407-post-rewrite-hook.sh