| 107 | } |
| 108 | |
| 109 | static int run_sequencer(int argc, const char **argv, const char *prefix, |
| 110 | struct replay_opts *opts) |
| 111 | { |
| 112 | const char * const * usage_str = revert_or_cherry_pick_usage(opts); |
| 113 | const char *me = action_name(opts); |
| 114 | const char *cleanup_arg = NULL; |
| 115 | const char sentinel_value = 0; /* value not important */ |
| 116 | const char *strategy = &sentinel_value; |
| 117 | const char *gpg_sign = &sentinel_value; |
| 118 | enum empty_action empty_opt = EMPTY_COMMIT_UNSPECIFIED; |
| 119 | int cmd = 0; |
| 120 | struct option base_options[] = { |
| 121 | OPT_CMDMODE(0, "quit", &cmd, N_("end revert or cherry-pick sequence"), 'q'), |
| 122 | OPT_CMDMODE(0, "continue", &cmd, N_("resume revert or cherry-pick sequence"), 'c'), |
| 123 | OPT_CMDMODE(0, "abort", &cmd, N_("cancel revert or cherry-pick sequence"), 'a'), |
| 124 | OPT_CMDMODE(0, "skip", &cmd, N_("skip current commit and continue"), 's'), |
| 125 | OPT_CLEANUP(&cleanup_arg), |
| 126 | OPT_BOOL('n', "no-commit", &opts->no_commit, N_("don't automatically commit")), |
| 127 | OPT_BOOL('e', "edit", &opts->edit, N_("edit the commit message")), |
| 128 | OPT_NOOP_NOARG('r', NULL), |
| 129 | OPT_BOOL('s', "signoff", &opts->signoff, N_("add a Signed-off-by trailer")), |
| 130 | OPT_CALLBACK('m', "mainline", opts, N_("parent-number"), |
| 131 | N_("select mainline parent"), option_parse_m), |
| 132 | OPT_RERERE_AUTOUPDATE(&opts->allow_rerere_auto), |
| 133 | OPT_STRING(0, "strategy", &strategy, N_("strategy"), N_("merge strategy")), |
| 134 | OPT_STRVEC('X', "strategy-option", &opts->xopts, N_("option"), |
| 135 | N_("option for merge strategy")), |
| 136 | { |
| 137 | .type = OPTION_STRING, |
| 138 | .short_name = 'S', |
| 139 | .long_name = "gpg-sign", |
| 140 | .value = &gpg_sign, |
| 141 | .argh = N_("key-id"), |
| 142 | .help = N_("GPG sign commit"), |
| 143 | .flags = PARSE_OPT_OPTARG, |
| 144 | .defval = (intptr_t) "", |
| 145 | }, |
| 146 | OPT_END() |
| 147 | }; |
| 148 | struct option *options = base_options; |
| 149 | |
| 150 | if (opts->action == REPLAY_PICK) { |
| 151 | struct option cp_extra[] = { |
| 152 | OPT_BOOL('x', NULL, &opts->record_origin, N_("append commit name")), |
| 153 | OPT_BOOL(0, "ff", &opts->allow_ff, N_("allow fast-forward")), |
| 154 | OPT_BOOL(0, "allow-empty", &opts->allow_empty, N_("preserve initially empty commits")), |
| 155 | OPT_BOOL(0, "allow-empty-message", &opts->allow_empty_message, N_("allow commits with empty messages")), |
| 156 | OPT_BOOL(0, "keep-redundant-commits", &opts->keep_redundant_commits, N_("deprecated: use --empty=keep instead")), |
| 157 | OPT_CALLBACK_F(0, "empty", &empty_opt, "(stop|drop|keep)", |
| 158 | N_("how to handle commits that become empty"), |
| 159 | PARSE_OPT_NONEG, parse_opt_empty), |
| 160 | OPT_END(), |
| 161 | }; |
| 162 | options = parse_options_concat(options, cp_extra); |
| 163 | } else if (opts->action == REPLAY_REVERT) { |
| 164 | struct option cp_extra[] = { |
| 165 | OPT_BOOL(0, "reference", &opts->commit_use_reference, |
| 166 | N_("use the 'reference' format to refer to commits")), |
no test coverage detected