Skip to content

Commit 393adf7

Browse files
agrngitster
authored andcommitted
sequencer: directly call pick_commits() from complete_action()
Currently, complete_action(), used by builtin/rebase.c to start a new rebase, calls sequencer_continue() to do it. Before the former calls pick_commits(), it - calls read_and_refresh_cache() -- this is unnecessary here as we've just called require_clean_work_tree() in complete_action() - calls read_populate_opts() -- this is unnecessary as we're starting a new rebase, so `opts' is fully populated - loads the todo list -- this is unnecessary as we've just populated the todo list in complete_action() - commits any staged changes -- this is unnecessary as we're starting a new rebase, so there are no staged changes - calls record_in_rewritten() -- this is unnecessary as we're starting a new rebase. This changes complete_action() to directly call pick_commits() to avoid these unnecessary steps. Signed-off-by: Alban Gruin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a2dd67f commit 393adf7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sequencer.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5140,15 +5140,21 @@ int complete_action(struct repository *r, struct replay_opts *opts, unsigned fla
51405140
return error_errno(_("could not write '%s'"), todo_file);
51415141
}
51425142

5143-
todo_list_release(&new_todo);
5143+
res = -1;
51445144

51455145
if (checkout_onto(r, opts, onto_name, &oid, orig_head))
5146-
return -1;
5146+
goto cleanup;
51475147

51485148
if (require_clean_work_tree(r, "rebase", "", 1, 1))
5149-
return -1;
5149+
goto cleanup;
51505150

5151-
return sequencer_continue(r, opts);
5151+
todo_list_write_total_nr(&new_todo);
5152+
res = pick_commits(r, &new_todo, opts);
5153+
5154+
cleanup:
5155+
todo_list_release(&new_todo);
5156+
5157+
return res;
51525158
}
51535159

51545160
struct subject2item_entry {

0 commit comments

Comments
 (0)