branch: quote branch/ref names to improve readability
[git/debian.git] / builtin / rebase--helper.c
blobc82b4dce6838fa039e9c2cfc769c7cd17a8ef562
1 #include "builtin.h"
2 #include "cache.h"
3 #include "config.h"
4 #include "parse-options.h"
5 #include "sequencer.h"
7 static const char * const builtin_rebase_helper_usage[] = {
8 N_("git rebase--helper [<options>]"),
9 NULL
12 int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
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()
27 git_config(git_default_config, NULL);
29 opts.action = REPLAY_INTERACTIVE_REBASE;
30 opts.allow_ff = 1;
31 opts.allow_empty = 1;
33 argc = parse_options(argc, argv, NULL, options,
34 builtin_rebase_helper_usage, PARSE_OPT_KEEP_ARGV0);
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);