revert: give --continue handling its own function
This makes pick_revisions() a little shorter and easier to read straight through. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Dec 10, 2011 at 06:47 UTC
1df9bf46d656970d0db254cb7faab0d0505802e0
1 file changed
+17
-11
builtin/revert.c
+17
-11
@@ -1038,6 +1038,21 @@ static int pick_commits(struct commit_list *todo_list, struct replay_opts *opts)
1038
return 0;
1039
}
1040
1041
+static int sequencer_continue(struct replay_opts *opts)
1042
+{
1043
+ struct commit_list *todo_list = NULL;
1044
+
1045
+ if (!file_exists(git_path(SEQ_TODO_FILE)))
1046
+ return error(_("No %s in progress"), action_name(opts));
1047
+ read_populate_opts(&opts);
1048
+ read_populate_todo(&todo_list, opts);
1049
+
1050
+ /* Verify that the conflict has been resolved */
1051
+ if (!index_differs_from("HEAD", 0))
1052
+ todo_list = todo_list->next;
1053
+ return pick_commits(todo_list, opts);
1054
+}
1055
+
1056
static int pick_revisions(struct replay_opts *opts)
1057
{
1058
struct commit_list *todo_list = NULL;
@@ -1056,17 +1071,8 @@ static int pick_revisions(struct replay_opts *opts)
1071
}
1072
if (opts->subcommand == REPLAY_ROLLBACK)
1073
return sequencer_rollback(opts);
1059
- if (opts->subcommand == REPLAY_CONTINUE) {
1060
- if (!file_exists(git_path(SEQ_TODO_FILE)))
1061
- return error(_("No %s in progress"), action_name(opts));
1062
- read_populate_opts(&opts);
1063
- read_populate_todo(&todo_list, opts);
1064
-
1065
- /* Verify that the conflict has been resolved */
1066
- if (!index_differs_from("HEAD", 0))
1067
- todo_list = todo_list->next;
1068
- return pick_commits(todo_list, opts);
1069
- }
1074
+ if (opts->subcommand == REPLAY_CONTINUE)
1075
+ return sequencer_continue(opts);
1076
1077
/*
1078
* Start a new cherry-pick/ revert sequence; but