sequencer: pass todo_item to do_pick_commit()
As an additional member of the structure todo_item will be required in future commits pass the complete structure. Mentored-by: Christian Couder <chriscool@tuxfamily.org> Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Charvi Mendiratta <charvi077@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charvi Mendiratta committed
Jan 29, 2021 at 23:50 UTC
ae70e34f234e675878a34b0bd76c43ffe79b95af
1 file changed
+11
-7
sequencer.c
+11
-7
@@ -1877,8 +1877,7 @@ static void record_in_rewritten(struct object_id *oid,
1877
}
1878
1879
static int do_pick_commit(struct repository *r,
1880
- enum todo_command command,
1881
- struct commit *commit,
1880
+ struct todo_item *item,
1881
struct replay_opts *opts,
1882
int final_fixup, int *check_todo)
1883
{
@@ -1891,6 +1890,8 @@ static int do_pick_commit(struct repository *r,
1890
struct commit_message msg = { NULL, NULL, NULL, NULL };
1891
struct strbuf msgbuf = STRBUF_INIT;
1892
int res, unborn = 0, reword = 0, allow, drop_commit;
1893
+ enum todo_command command = item->command;
1894
+ struct commit *commit = item->commit;
1895
1896
if (opts->no_commit) {
1897
/*
@@ -4140,8 +4141,8 @@ static int pick_commits(struct repository *r,
4141
setenv(GIT_REFLOG_ACTION, reflog_message(opts,
4142
command_to_string(item->command), NULL),
4143
1);
4143
- res = do_pick_commit(r, item->command, item->commit,
4144
- opts, is_final_fixup(todo_list),
4144
+ res = do_pick_commit(r, item, opts,
4145
+ is_final_fixup(todo_list),
4146
&check_todo);
4147
if (is_rebase_i(opts))
4148
setenv(GIT_REFLOG_ACTION, prev_reflog_action, 1);
@@ -4603,11 +4604,14 @@ static int single_pick(struct repository *r,
4604
struct replay_opts *opts)
4605
{
4606
int check_todo;
4607
+ struct todo_item item;
4608
+
4609
+ item.command = opts->action == REPLAY_PICK ?
4610
+ TODO_PICK : TODO_REVERT;
4611
+ item.commit = cmit;
4612
4613
setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
4608
- return do_pick_commit(r, opts->action == REPLAY_PICK ?
4609
- TODO_PICK : TODO_REVERT, cmit, opts, 0,
4610
- &check_todo);
4614
+ return do_pick_commit(r, &item, opts, 0, &check_todo);
4615
}
4616
4617
int sequencer_pick_revisions(struct repository *r,