60
int allow_rerere_auto;
61
62
int mainline;
63
- int commit_argc;
64
- const char **commit_argv;
63
64
/* Merge strategy */
65
const char *strategy;
66
const char **xopts;
67
size_t xopts_nr, xopts_alloc;
68
+
69
+ /* Only used by REPLAY_NONE */
70
+ struct rev_info *revs;
71
};
72
73
#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
170
die(_("program error"));
171
}
172
172
- opts->commit_argc = parse_options(argc, argv, NULL, options, usage_str,
173
- PARSE_OPT_KEEP_ARGV0 |
174
- PARSE_OPT_KEEP_UNKNOWN);
173
+ argc = parse_options(argc, argv, NULL, options, usage_str,
174
+ PARSE_OPT_KEEP_ARGV0 |
175
+ PARSE_OPT_KEEP_UNKNOWN);
176
177
/* Check for incompatible subcommands */
178
verify_opt_mutually_compatible(me,
214
NULL);
215
}
216
216
- else if (opts->commit_argc < 2)
217
- usage_with_options(usage_str, options);
218
-
217
if (opts->allow_ff)
218
verify_opt_compatible(me, "--ff",
219
"--signoff", opts->signoff,
221
"-x", opts->record_origin,
222
"--edit", opts->edit,
223
NULL);
226
- opts->commit_argv = argv;
224
+
225
+ if (opts->subcommand != REPLAY_NONE) {
226
+ opts->revs = NULL;
227
+ } else {
228
+ opts->revs = xmalloc(sizeof(*opts->revs));
229
+ init_revisions(opts->revs, NULL);
230
+ opts->revs->no_walk = 1;
231
+ if (argc < 2)
232
+ usage_with_options(usage_str, options);
233
+ argc = setup_revisions(argc, argv, opts->revs, NULL);
234
+ }
235
+
236
+ if (argc > 1)
237
+ usage_with_options(usage_str, options);
238
}
239
240
struct commit_message {
642
return res;
643
}
644
634
-static void prepare_revs(struct rev_info *revs, struct replay_opts *opts)
645
+static void prepare_revs(struct replay_opts *opts)
646
{
636
- int argc;
637
-
638
- init_revisions(revs, NULL);
639
- revs->no_walk = 1;
647
if (opts->action != REVERT)
641
- revs->reverse = 1;
648
+ opts->revs->reverse ^= 1;
649
643
- argc = setup_revisions(opts->commit_argc, opts->commit_argv, revs, NULL);
644
- if (argc > 1)
645
- usage(*revert_or_cherry_pick_usage(opts));
646
-
647
- if (prepare_revision_walk(revs))
650
+ if (prepare_revision_walk(opts->revs))
651
die(_("revision walk setup failed"));
652
650
- if (!revs->commits)
653
+ if (!opts->revs->commits)
654
die(_("empty commit set passed"));
655
}
656
847
static void walk_revs_populate_todo(struct commit_list **todo_list,
848
struct replay_opts *opts)
849
{
847
- struct rev_info revs;
850
struct commit *commit;
851
struct commit_list **next;
852
851
- prepare_revs(&revs, opts);
853
+ prepare_revs(opts);
854
855
next = todo_list;
854
- while ((commit = get_revision(&revs)))
856
+ while ((commit = get_revision(opts->revs)))
857
next = commit_list_append(commit, next);
858
}
859
1077
struct commit_list *todo_list = NULL;
1078
unsigned char sha1[20];
1079
1080
+ if (opts->subcommand == REPLAY_NONE)
1081
+ assert(opts->revs);
1082
+
1083
read_and_refresh_cache(opts);
1084
1085
/*