revert: rearrange pick_revisions() for clarity

Deal completely with "cherry-pick --quit" and --continue at the
beginning of pick_revisions(), leaving the rest of the function for
the more interesting "git cherry-pick <commits>" case.

No functional change intended.  The impact is just to unindent the
code a little.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jonathan Nieder 2011-11-22 05:15:10 -06:00 committed by Junio C Hamano
parent f80a87262a
commit dffc860028
1 changed files with 25 additions and 25 deletions

View File

@ -971,16 +971,19 @@ static int pick_revisions(struct replay_opts *opts)
if (opts->subcommand == REPLAY_REMOVE_STATE) {
remove_sequencer_state(1);
return 0;
} else if (opts->subcommand == REPLAY_CONTINUE) {
}
if (opts->subcommand == REPLAY_CONTINUE) {
if (!file_exists(git_path(SEQ_TODO_FILE)))
goto error;
return error(_("No %s in progress"), action_name(opts));
read_populate_opts(&opts);
read_populate_todo(&todo_list, opts);

/* Verify that the conflict has been resolved */
if (!index_differs_from("HEAD", 0))
todo_list = todo_list->next;
} else {
return pick_commits(todo_list, opts);
}

/*
* Start a new cherry-pick/ revert sequence; but
* first, make sure that an existing one isn't in
@ -1001,10 +1004,7 @@ static int pick_revisions(struct replay_opts *opts)
}
save_head(sha1_to_hex(sha1));
save_opts(opts);
}
return pick_commits(todo_list, opts);
error:
return error(_("No %s in progress"), action_name(opts));
}

int cmd_revert(int argc, const char **argv, const char *prefix)