cherry-pick/revert: reject --rerere-autoupdate when continuing
[git] / builtin / rebase--helper.c
1 #include "builtin.h"
2 #include "cache.h"
3 #include "config.h"
4 #include "parse-options.h"
5 #include "sequencer.h"
6
7 static const char * const builtin_rebase_helper_usage[] = {
8         N_("git rebase--helper [<options>]"),
9         NULL
10 };
11
12 int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
13 {
14         struct replay_opts opts = REPLAY_OPTS_INIT;
15         enum {
16                 CONTINUE = 1, ABORT
17         } command = 0;
18         struct option options[] = {
19                 OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
20                 OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
21                                 CONTINUE),
22                 OPT_CMDMODE(0, "abort", &command, N_("abort rebase"),
23                                 ABORT),
24                 OPT_END()
25         };
26
27         git_config(git_default_config, NULL);
28
29         opts.action = REPLAY_INTERACTIVE_REBASE;
30         opts.allow_ff = 1;
31         opts.allow_empty = 1;
32
33         argc = parse_options(argc, argv, NULL, options,
34                         builtin_rebase_helper_usage, PARSE_OPT_KEEP_ARGV0);
35
36         if (command == CONTINUE && argc == 1)
37                 return !!sequencer_continue(&opts);
38         if (command == ABORT && argc == 1)
39                 return !!sequencer_remove_state(&opts);
40         usage_with_options(builtin_rebase_helper_usage, options);
41 }