1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-28 12:59:41 +01:00

sequencer: delete REBASE_HEAD in correct repo when picking commits

When picking commits, we delete some state before executing the next
sequencer action on interactive rebases. But while we use the correct
repository to calculate paths to state files that need deletion, we use
the repo-less `delete_ref()` function to delete REBASE_HEAD. Thus, if
the sequencer ran in a different repository than `the_repository`, we
would end up deleting the ref in the wrong repository.

Fix this by using `refs_delete_ref()` instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt 2024-01-19 11:40:04 +01:00 committed by Junio C Hamano
parent 821f6632b0
commit bb02e95f3b

View file

@ -4767,7 +4767,8 @@ static int pick_commits(struct repository *r,
unlink(rebase_path_author_script());
unlink(git_path_merge_head(r));
unlink(git_path_auto_merge(r));
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
refs_delete_ref(get_main_ref_store(r), "", "REBASE_HEAD",
NULL, REF_NO_DEREF);
if (item->command == TODO_BREAK) {
if (!opts->verbose)