Skip to content

Commit 36ac861

Browse files
phillipwoodgitster
authored andcommitted
rebase -i: move unlink() calls
At the start of each iteration the loop that picks commits removes the state files from the previous pick. However some of these files are only written if there are conflicts in which case we exit the loop before the end of the loop body. Therefore they only need to be removed when the rebase continues, not at the start of each iteration. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c6990c commit 36ac861

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sequencer.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4639,6 +4639,10 @@ static int pick_commits(struct repository *r,
46394639
if (read_and_refresh_cache(r, opts))
46404640
return -1;
46414641

4642+
unlink(rebase_path_message());
4643+
unlink(rebase_path_stopped_sha());
4644+
unlink(rebase_path_amend());
4645+
46424646
while (todo_list->current < todo_list->nr) {
46434647
struct todo_item *item = todo_list->items + todo_list->current;
46444648
const char *arg = todo_item_get_arg(todo_list, item);
@@ -4662,10 +4666,7 @@ static int pick_commits(struct repository *r,
46624666
todo_list->total_nr,
46634667
opts->verbose ? "\n" : "\r");
46644668
}
4665-
unlink(rebase_path_message());
46664669
unlink(rebase_path_author_script());
4667-
unlink(rebase_path_stopped_sha());
4668-
unlink(rebase_path_amend());
46694670
unlink(git_path_merge_head(r));
46704671
unlink(git_path_auto_merge(r));
46714672
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);

0 commit comments

Comments
 (0)