Merge branch 'js/rebase-stat-unrelated-fix'
[gitweb.git] / builtin / rebase--interactive.c
index aaf13c9621dccab23febee90f6617a6f87e45120..a2ab68ed063224be123a3f5e8831afdc3ed649a0 100644 (file)
@@ -140,7 +140,8 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
                *switch_to = NULL, *cmd = NULL;
        char *raw_strategies = NULL;
        enum {
-               NONE = 0, CONTINUE, SKIP, EDIT_TODO, SHOW_CURRENT_PATCH
+               NONE = 0, CONTINUE, SKIP, EDIT_TODO, SHOW_CURRENT_PATCH,
+               SHORTEN_OIDS, EXPAND_OIDS, CHECK_TODO_LIST, REARRANGE_SQUASH, ADD_EXEC
        } command = 0;
        struct option options[] = {
                OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
@@ -161,6 +162,16 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
                            EDIT_TODO),
                OPT_CMDMODE(0, "show-current-patch", &command, N_("show the current patch"),
                            SHOW_CURRENT_PATCH),
+               OPT_CMDMODE(0, "shorten-ids", &command,
+                       N_("shorten commit ids in the todo list"), SHORTEN_OIDS),
+               OPT_CMDMODE(0, "expand-ids", &command,
+                       N_("expand commit ids in the todo list"), EXPAND_OIDS),
+               OPT_CMDMODE(0, "check-todo-list", &command,
+                       N_("check the todo list"), CHECK_TODO_LIST),
+               OPT_CMDMODE(0, "rearrange-squash", &command,
+                       N_("rearrange fixup/squash lines"), REARRANGE_SQUASH),
+               OPT_CMDMODE(0, "add-exec-commands", &command,
+                       N_("insert exec commands in todo list"), ADD_EXEC),
                OPT_STRING(0, "onto", &onto, N_("onto"), N_("onto")),
                OPT_STRING(0, "restrict-revision", &restrict_revision,
                           N_("restrict-revision"), N_("restrict revision")),
@@ -203,6 +214,7 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
        flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
        flags |= rebase_merges ? TODO_LIST_REBASE_MERGES : 0;
        flags |= rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0;
+       flags |= command == SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0;
 
        if (rebase_cousins >= 0 && !rebase_merges)
                warning(_("--[no-]rebase-cousins has no effect without "
@@ -238,6 +250,19 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
 
                break;
        }
+       case SHORTEN_OIDS:
+       case EXPAND_OIDS:
+               ret = transform_todos(flags);
+               break;
+       case CHECK_TODO_LIST:
+               ret = check_todo_list();
+               break;
+       case REARRANGE_SQUASH:
+               ret = rearrange_squash();
+               break;
+       case ADD_EXEC:
+               ret = sequencer_add_exec_commands(cmd);
+               break;
        default:
                BUG("invalid command '%d'", command);
        }