]> git.ipfire.org Git - thirdparty/git.git/commit
replay: resolve the replay base outside pick_regular_commit()
authorToon Claes <toon@iotcl.com>
Tue, 28 Jul 2026 15:45:52 +0000 (17:45 +0200)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Jul 2026 18:27:41 +0000 (11:27 -0700)
commit959a273edd9cd9ca48b6c1a6f0922ffb56d37835
treeb86cc50f8f49e0bfb89ae3611319b6dd9ee0a2e9
parentdf94e2b767ddc1968d5cfff55b87d5aec923e8a7
replay: resolve the replay base outside pick_regular_commit()

Depending on what gets passed into the function pick_regular_commit(),
it decides the new base for the replayed commit. It first tries to find
the replayed results of `pickme`'s parent in the `replayed_commits` map.
If not found, it falls back to `onto`.

When using git-replay(1) with --onto, the fallback is the revision
passed in with this option, but when using --revert, the fallback is
`last_commit`.

It's rather confusing the base is decided partly inside
pick_regular_commit() and partly by its caller.

Move the base selection completely into the caller: replay_revisions().
This bundles all the logic of deciding on the base together. Also, this
reduces the number of parameters of pick_regular_commit(), making its
interface cleaner.

This refactoring doesn't bring any behavior changes.

Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
replay.c