]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/rebase--helper.c
rebase -i: rewrite append_todo_help() in C
[thirdparty/git.git] / builtin / rebase--helper.c
index f7c2a5fdc815a892b99d6561d73d953740bf789a..05e73e71d42b097f0b60ff7a20408894da4f48cd 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>]"),
@@ -12,12 +13,12 @@ static const char * const builtin_rebase_helper_usage[] = {
 int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
 {
        struct replay_opts opts = REPLAY_OPTS_INIT;
-       unsigned flags = 0, keep_empty = 0, rebase_merges = 0;
+       unsigned flags = 0, keep_empty = 0, rebase_merges = 0, write_edit_todo = 0;
        int abbreviate_commands = 0, rebase_cousins = -1;
        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
        } command = 0;
        struct option options[] = {
                OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -27,6 +28,8 @@ 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_BOOL(0, "write-edit-todo", &write_edit_todo,
+                        N_("append the edit-todo message to the todo-list")),
                OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
                                CONTINUE),
                OPT_CMDMODE(0, "abort", &command, N_("abort rebase"),
@@ -45,6 +48,8 @@ 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_END()
        };
 
@@ -84,5 +89,7 @@ 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(write_edit_todo, keep_empty);
        usage_with_options(builtin_rebase_helper_usage, options);
 }