3 #include "parse-options.h"
6 static const char * const builtin_rebase_helper_usage[] = {
7 N_("git rebase--helper [<options>]"),
11 int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
13 struct replay_opts opts = REPLAY_OPTS_INIT;
17 struct option options[] = {
18 OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
19 OPT_BOOL(0, "signoff", &opts.signoff, N_("add Signed-off-by:")),
20 OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
22 OPT_CMDMODE(0, "abort", &command, N_("abort rebase"),
27 git_config(git_default_config, NULL);
29 opts.action = REPLAY_INTERACTIVE_REBASE;
30 /* By default, fast-forward is allowed, unless sign-off gets requested.
31 * To differentiate between a command-line --ff and the default,
32 * we set the default to -1 */
36 argc = parse_options(argc, argv, NULL, options,
37 builtin_rebase_helper_usage, PARSE_OPT_KEEP_ARGV0);
39 if (opts.allow_ff < 0) {
40 opts.allow_ff = !opts.signoff;
43 if (command == CONTINUE && argc == 1)
44 return !!sequencer_continue(&opts);
45 if (command == ABORT && argc == 1)
46 return !!sequencer_remove_state(&opts);
47 usage_with_options(builtin_rebase_helper_usage, options);