Skip to content

Commit bb02e95

Browse files
pks-tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 821f663 commit bb02e95

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sequencer.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4767,7 +4767,8 @@ static int pick_commits(struct repository *r,
47674767
unlink(rebase_path_author_script());
47684768
unlink(git_path_merge_head(r));
47694769
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);
47714772

47724773
if (item->command == TODO_BREAK) {
47734774
if (!opts->verbose)

0 commit comments

Comments
 (0)