]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/rebase--helper.c
rebase -i: rewrite complete_action() in C
[thirdparty/git.git] / builtin / rebase--helper.c
index bed3dd2b9519099fb339b02cc0e2f20c75e8d080..01b33339589e34e3d1c3696076b4baa51d590bb8 100644 (file)
@@ -13,13 +13,13 @@ 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, autosquash = 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, APPEND_TODO_HELP, EDIT_TODO, PREPARE_BRANCH,
-               CHECKOUT_ONTO
+               CHECKOUT_ONTO, COMPLETE_ACTION
        } command = 0;
        struct option options[] = {
                OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -29,6 +29,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, "autosquash", &autosquash,
+                        N_("move commits that begin with squash!/fixup!")),
                OPT__VERBOSE(&opts.verbose, N_("be verbose")),
                OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
                                CONTINUE),
@@ -57,6 +59,8 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
                            N_("prepare the branch to be rebased"), PREPARE_BRANCH),
                OPT_CMDMODE(0, "checkout-onto", &command,
                            N_("checkout a commit"), CHECKOUT_ONTO),
+               OPT_CMDMODE(0, "complete-action", &command,
+                           N_("complete the action"), COMPLETE_ACTION),
                OPT_END()
        };
 
@@ -110,5 +114,9 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
                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]);
+       if (command == COMPLETE_ACTION && argc == 6)
+               return !!complete_action(&opts, flags, argv[1], argv[2], argv[3],
+                                        argv[4], argv[5], autosquash);
+
        usage_with_options(builtin_rebase_helper_usage, options);
 }