Skip to content

Commit e1be548

Browse files
committed
Merge 'rebase-i-extra' into HEAD
2 parents 68cc555 + a238370 commit e1be548

File tree

6 files changed

+616
-336
lines changed

6 files changed

+616
-336
lines changed

builtin/rebase--helper.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,30 @@ static const char * const builtin_rebase_helper_usage[] = {
1111
int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
1212
{
1313
struct replay_opts opts = REPLAY_OPTS_INIT;
14+
int keep_empty = 0;
1415
enum {
15-
CONTINUE = 1, ABORT
16+
CONTINUE = 1, ABORT, MAKE_SCRIPT, SHORTEN_SHA1S, EXPAND_SHA1S,
17+
CHECK_TODO_LIST, SKIP_UNNECESSARY_PICKS, REARRANGE_SQUASH
1618
} command = 0;
1719
struct option options[] = {
1820
OPT_BOOL(0, "ff", &opts.allow_ff, N_("allow fast-forward")),
21+
OPT_BOOL(0, "keep-empty", &keep_empty, N_("keep empty commits")),
1922
OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
2023
CONTINUE),
2124
OPT_CMDMODE(0, "abort", &command, N_("abort rebase"),
2225
ABORT),
26+
OPT_CMDMODE(0, "make-script", &command,
27+
N_("make rebase script"), MAKE_SCRIPT),
28+
OPT_CMDMODE(0, "shorten-sha1s", &command,
29+
N_("shorten SHA-1s in the todo list"), SHORTEN_SHA1S),
30+
OPT_CMDMODE(0, "expand-sha1s", &command,
31+
N_("expand SHA-1s in the todo list"), EXPAND_SHA1S),
32+
OPT_CMDMODE(0, "check-todo-list", &command,
33+
N_("check the todo list"), CHECK_TODO_LIST),
34+
OPT_CMDMODE(0, "skip-unnecessary-picks", &command,
35+
N_("skip unnecessary picks"), SKIP_UNNECESSARY_PICKS),
36+
OPT_CMDMODE(0, "rearrange-squash", &command,
37+
N_("rearrange fixup/squash lines"), REARRANGE_SQUASH),
2338
OPT_END()
2439
};
2540

@@ -36,5 +51,17 @@ int cmd_rebase__helper(int argc, const char **argv, const char *prefix)
3651
return !!sequencer_continue(&opts);
3752
if (command == ABORT && argc == 1)
3853
return !!sequencer_remove_state(&opts);
54+
if (command == MAKE_SCRIPT && argc > 1)
55+
return !!sequencer_make_script(keep_empty, stdout, argc, argv);
56+
if (command == SHORTEN_SHA1S && argc == 1)
57+
return !!transform_todo_ids(1);
58+
if (command == EXPAND_SHA1S && argc == 1)
59+
return !!transform_todo_ids(0);
60+
if (command == CHECK_TODO_LIST && argc == 1)
61+
return !!check_todo_list();
62+
if (command == SKIP_UNNECESSARY_PICKS && argc == 1)
63+
return !!skip_unnecessary_picks();
64+
if (command == REARRANGE_SQUASH && argc == 1)
65+
return !!rearrange_squash();
3966
usage_with_options(builtin_rebase_helper_usage, options);
4067
}

0 commit comments

Comments
 (0)