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>

Patrick Steinhardt committed Jan 19, 2024 at 11:40 UTC bb02e95f3b25d933272bcf9d6883828d26271f69
1 file changed +2 -1
sequencer.c
+2 -1
@@ -4767,7 +4767,8 @@ static int pick_commits(struct repository *r,
4767 unlink(rebase_path_author_script());
4768 unlink(git_path_merge_head(r));
4769 unlink(git_path_auto_merge(r));
4770 - delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
4770 + refs_delete_ref(get_main_ref_store(r), "", "REBASE_HEAD",
4771 + NULL, REF_NO_DEREF);
4772
4773 if (item->command == TODO_BREAK) {
4774 if (!opts->verbose)