sequencer: refactor append_todo_help() to write its message to a buffer
[gitweb.git] / builtin / rebase--helper.c
index f7c2a5fdc815a892b99d6561d73d953740bf789a..313092c4659ebac6072e35993646f2e5add1e579 100644 (file)
@@ -3,6 +3,7 @@
 #include "config.h"
 #include "parse-options.h"
 #include "sequencer.h"
+#include "rebase-interactive.h"
 
 static const char * const builtin_rebase_helper_usage[] = {
        N_("git rebase--helper [<options>]"),
@@ -17,7 +18,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
        enum {
                CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_OIDS, EXPAND_OIDS,
                CHECK_TODO_LIST, SKIP_UNNECESSARY_PICKS, REARRANGE_SQUASH,
-               ADD_EXEC
+               ADD_EXEC, APPEND_TODO_HELP, EDIT_TODO, PREPARE_BRANCH,
+               CHECKOUT_ONTO
        } command = 0;
        struct option options[] = {
                OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -27,6 +29,7 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "rebase-merges", &rebase_merges, N_("rebase merge commits")),
                OPT_BOOL(0, "rebase-cousins", &rebase_cousins,
                         N_("keep original branch points of cousins")),
+               OPT__VERBOSE(&opts.verbose, N_("be verbose")),
                OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
                                CONTINUE),
                OPT_CMDMODE(0, "abort", &command, N_("abort rebase"),
@@ -45,6 +48,15 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
                        N_("rearrange fixup/squash lines"), REARRANGE_SQUASH),
                OPT_CMDMODE(0, "add-exec-commands", &command,
                        N_("insert exec commands in todo list"), ADD_EXEC),
+               OPT_CMDMODE(0, "append-todo-help", &command,
+                           N_("insert the help in the todo list"), APPEND_TODO_HELP),
+               OPT_CMDMODE(0, "edit-todo", &command,
+                           N_("edit the todo list during an interactive rebase"),
+                           EDIT_TODO),
+               OPT_CMDMODE(0, "prepare-branch", &command,
+                           N_("prepare the branch to be rebased"), PREPARE_BRANCH),
+               OPT_CMDMODE(0, "checkout-onto", &command,
+                           N_("checkout a commit"), CHECKOUT_ONTO),
                OPT_END()
        };
 
@@ -84,5 +96,13 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
                return !!rearrange_squash();
        if (command == ADD_EXEC && argc == 2)
                return !!sequencer_add_exec_commands(argv[1]);
+       if (command == APPEND_TODO_HELP && argc == 1)
+               return !!append_todo_help_to_file(0, keep_empty);
+       if (command == EDIT_TODO && argc == 1)
+               return !!edit_todo_list(flags);
+       if (command == PREPARE_BRANCH && argc == 2)
+               return !!prepare_branch_to_be_rebased(&opts, argv[1]);
+       if (command == CHECKOUT_ONTO && argc == 4)
+               return !!checkout_onto(&opts, argv[1], argv[2], argv[3]);
        usage_with_options(builtin_rebase_helper_usage, options);
 }