]> git.ipfire.org Git - thirdparty/git.git/commitdiff
sequencer: delete REBASE_HEAD in correct repo when picking commits
authorPatrick Steinhardt <ps@pks.im>
Fri, 19 Jan 2024 10:40:04 +0000 (11:40 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Jan 2024 19:10:41 +0000 (11:10 -0800)
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>
sequencer.c

index b9cbc290ea6dd5d28a0786208219f1f5643a4391..6f620f57179d8f318fc9b76c461953f53298649a 100644 (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)