rebase: drop the internal `rebase--interactive` command
It was only used by the `--preserve-merges` backend, which we just removed. Helped-by: Alban Gruin <alban.gruin@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Sep 7, 2021 at 21:05 UTC
5b55b32bd2c36fea43f516fa36f8276655954f40
2 files changed
+1
-193
builtin/rebase.c
+1
-192
@@ -162,12 +162,7 @@ enum action {
162
ACTION_ABORT,
163
ACTION_QUIT,
164
ACTION_EDIT_TODO,
165
- ACTION_SHOW_CURRENT_PATCH,
166
- ACTION_SHORTEN_OIDS,
167
- ACTION_EXPAND_OIDS,
168
- ACTION_CHECK_TODO_LIST,
169
- ACTION_REARRANGE_SQUASH,
170
- ACTION_ADD_EXEC
165
+ ACTION_SHOW_CURRENT_PATCH
166
};
167
168
static const char *action_names[] = { "undefined",
@@ -178,81 +173,6 @@ static const char *action_names[] = { "undefined",
173
"edit_todo",
174
"show_current_patch" };
175
181
-static int add_exec_commands(struct string_list *commands)
182
-{
183
- const char *todo_file = rebase_path_todo();
184
- struct todo_list todo_list = TODO_LIST_INIT;
185
- int res;
186
-
187
- if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
188
- return error_errno(_("could not read '%s'."), todo_file);
189
-
190
- if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
191
- &todo_list)) {
192
- todo_list_release(&todo_list);
193
- return error(_("unusable todo list: '%s'"), todo_file);
194
- }
195
-
196
- todo_list_add_exec_commands(&todo_list, commands);
197
- res = todo_list_write_to_file(the_repository, &todo_list,
198
- todo_file, NULL, NULL, -1, 0);
199
- todo_list_release(&todo_list);
200
-
201
- if (res)
202
- return error_errno(_("could not write '%s'."), todo_file);
203
- return 0;
204
-}
205
-
206
-static int rearrange_squash_in_todo_file(void)
207
-{
208
- const char *todo_file = rebase_path_todo();
209
- struct todo_list todo_list = TODO_LIST_INIT;
210
- int res = 0;
211
-
212
- if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
213
- return error_errno(_("could not read '%s'."), todo_file);
214
- if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
215
- &todo_list)) {
216
- todo_list_release(&todo_list);
217
- return error(_("unusable todo list: '%s'"), todo_file);
218
- }
219
-
220
- res = todo_list_rearrange_squash(&todo_list);
221
- if (!res)
222
- res = todo_list_write_to_file(the_repository, &todo_list,
223
- todo_file, NULL, NULL, -1, 0);
224
-
225
- todo_list_release(&todo_list);
226
-
227
- if (res)
228
- return error_errno(_("could not write '%s'."), todo_file);
229
- return 0;
230
-}
231
-
232
-static int transform_todo_file(unsigned flags)
233
-{
234
- const char *todo_file = rebase_path_todo();
235
- struct todo_list todo_list = TODO_LIST_INIT;
236
- int res;
237
-
238
- if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
239
- return error_errno(_("could not read '%s'."), todo_file);
240
-
241
- if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
242
- &todo_list)) {
243
- todo_list_release(&todo_list);
244
- return error(_("unusable todo list: '%s'"), todo_file);
245
- }
246
-
247
- res = todo_list_write_to_file(the_repository, &todo_list, todo_file,
248
- NULL, NULL, -1, flags);
249
- todo_list_release(&todo_list);
250
-
251
- if (res)
252
- return error_errno(_("could not write '%s'."), todo_file);
253
- return 0;
254
-}
255
-
176
static int edit_todo_file(unsigned flags)
177
{
178
const char *todo_file = rebase_path_todo();
@@ -402,7 +322,6 @@ static int run_sequencer_rebase(struct rebase_options *opts,
322
flags |= opts->rebase_merges ? TODO_LIST_REBASE_MERGES : 0;
323
flags |= opts->rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0;
324
flags |= opts->root_with_onto ? TODO_LIST_ROOT_WITH_ONTO : 0;
405
- flags |= command == ACTION_SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0;
325
flags |= opts->reapply_cherry_picks ? TODO_LIST_REAPPLY_CHERRY_PICKS : 0;
326
327
switch (command) {
@@ -437,24 +356,6 @@ static int run_sequencer_rebase(struct rebase_options *opts,
356
357
break;
358
}
440
- case ACTION_SHORTEN_OIDS:
441
- case ACTION_EXPAND_OIDS:
442
- ret = transform_todo_file(flags);
443
- break;
444
- case ACTION_CHECK_TODO_LIST:
445
- ret = check_todo_list_from_file(the_repository);
446
- break;
447
- case ACTION_REARRANGE_SQUASH:
448
- ret = rearrange_squash_in_todo_file();
449
- break;
450
- case ACTION_ADD_EXEC: {
451
- struct string_list commands = STRING_LIST_INIT_DUP;
452
-
453
- split_exec_commands(opts->cmd, &commands);
454
- ret = add_exec_commands(&commands);
455
- string_list_clear(&commands, 0);
456
- break;
457
- }
359
default:
360
BUG("invalid command '%d'", command);
361
}
@@ -476,98 +377,6 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg,
377
return 0;
378
}
379
479
-static const char * const builtin_rebase_interactive_usage[] = {
480
- N_("git rebase--interactive [<options>]"),
481
- NULL
482
-};
483
-
484
-int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
485
-{
486
- struct rebase_options opts = REBASE_OPTIONS_INIT;
487
- struct object_id squash_onto = *null_oid();
488
- enum action command = ACTION_NONE;
489
- struct option options[] = {
490
- OPT_NEGBIT(0, "ff", &opts.flags, N_("allow fast-forward"),
491
- REBASE_FORCE),
492
- OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
493
- N_("keep commits which start empty"),
494
- PARSE_OPT_NOARG | PARSE_OPT_HIDDEN,
495
- parse_opt_keep_empty),
496
- OPT_BOOL_F(0, "allow-empty-message", &opts.allow_empty_message,
497
- N_("allow commits with empty messages"),
498
- PARSE_OPT_HIDDEN),
499
- OPT_BOOL(0, "rebase-merges", &opts.rebase_merges, N_("rebase merge commits")),
500
- OPT_BOOL(0, "rebase-cousins", &opts.rebase_cousins,
501
- N_("keep original branch points of cousins")),
502
- OPT_BOOL(0, "autosquash", &opts.autosquash,
503
- N_("move commits that begin with squash!/fixup!")),
504
- OPT_BOOL(0, "signoff", &opts.signoff, N_("sign commits")),
505
- OPT_BIT('v', "verbose", &opts.flags,
506
- N_("display a diffstat of what changed upstream"),
507
- REBASE_NO_QUIET | REBASE_VERBOSE | REBASE_DIFFSTAT),
508
- OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
509
- ACTION_CONTINUE),
510
- OPT_CMDMODE(0, "skip", &command, N_("skip commit"), ACTION_SKIP),
511
- OPT_CMDMODE(0, "edit-todo", &command, N_("edit the todo list"),
512
- ACTION_EDIT_TODO),
513
- OPT_CMDMODE(0, "show-current-patch", &command, N_("show the current patch"),
514
- ACTION_SHOW_CURRENT_PATCH),
515
- OPT_CMDMODE(0, "shorten-ids", &command,
516
- N_("shorten commit ids in the todo list"), ACTION_SHORTEN_OIDS),
517
- OPT_CMDMODE(0, "expand-ids", &command,
518
- N_("expand commit ids in the todo list"), ACTION_EXPAND_OIDS),
519
- OPT_CMDMODE(0, "check-todo-list", &command,
520
- N_("check the todo list"), ACTION_CHECK_TODO_LIST),
521
- OPT_CMDMODE(0, "rearrange-squash", &command,
522
- N_("rearrange fixup/squash lines"), ACTION_REARRANGE_SQUASH),
523
- OPT_CMDMODE(0, "add-exec-commands", &command,
524
- N_("insert exec commands in todo list"), ACTION_ADD_EXEC),
525
- { OPTION_CALLBACK, 0, "onto", &opts.onto, N_("onto"), N_("onto"),
526
- PARSE_OPT_NONEG, parse_opt_commit, 0 },
527
- { OPTION_CALLBACK, 0, "restrict-revision", &opts.restrict_revision,
528
- N_("restrict-revision"), N_("restrict revision"),
529
- PARSE_OPT_NONEG, parse_opt_commit, 0 },
530
- { OPTION_CALLBACK, 0, "squash-onto", &squash_onto, N_("squash-onto"),
531
- N_("squash onto"), PARSE_OPT_NONEG, parse_opt_object_id, 0 },
532
- { OPTION_CALLBACK, 0, "upstream", &opts.upstream, N_("upstream"),
533
- N_("the upstream commit"), PARSE_OPT_NONEG, parse_opt_commit,
534
- 0 },
535
- OPT_STRING(0, "head-name", &opts.head_name, N_("head-name"), N_("head name")),
536
- { OPTION_STRING, 'S', "gpg-sign", &opts.gpg_sign_opt, N_("key-id"),
537
- N_("GPG-sign commits"),
538
- PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
539
- OPT_STRING(0, "strategy", &opts.strategy, N_("strategy"),
540
- N_("rebase strategy")),
541
- OPT_STRING(0, "strategy-opts", &opts.strategy_opts, N_("strategy-opts"),
542
- N_("strategy options")),
543
- OPT_STRING(0, "switch-to", &opts.switch_to, N_("switch-to"),
544
- N_("the branch or commit to checkout")),
545
- OPT_STRING(0, "onto-name", &opts.onto_name, N_("onto-name"), N_("onto name")),
546
- OPT_STRING(0, "cmd", &opts.cmd, N_("cmd"), N_("the command to run")),
547
- OPT_RERERE_AUTOUPDATE(&opts.allow_rerere_autoupdate),
548
- OPT_BOOL(0, "reschedule-failed-exec", &opts.reschedule_failed_exec,
549
- N_("automatically re-schedule any `exec` that fails")),
550
- OPT_END()
551
- };
552
-
553
- opts.rebase_cousins = -1;
554
-
555
- if (argc == 1)
556
- usage_with_options(builtin_rebase_interactive_usage, options);
557
-
558
- argc = parse_options(argc, argv, prefix, options,
559
- builtin_rebase_interactive_usage, PARSE_OPT_KEEP_ARGV0);
560
-
561
- if (!is_null_oid(&squash_onto))
562
- opts.squash_onto = &squash_onto;
563
-
564
- if (opts.rebase_cousins >= 0 && !opts.rebase_merges)
565
- warning(_("--[no-]rebase-cousins has no effect without "
566
- "--rebase-merges"));
567
-
568
- return !!run_sequencer_rebase(&opts, command);
569
-}
570
-
380
static int is_merge(struct rebase_options *opts)
381
{
382
return opts->type == REBASE_MERGE;
git.c
-1
@@ -577,7 +577,6 @@ static struct cmd_struct commands[] = {
577
{ "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER },
578
{ "read-tree", cmd_read_tree, RUN_SETUP | SUPPORT_SUPER_PREFIX},
579
{ "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE },
580
- { "rebase--interactive", cmd_rebase__interactive, RUN_SETUP | NEED_WORK_TREE },
580
{ "receive-pack", cmd_receive_pack },
581
{ "reflog", cmd_reflog, RUN_SETUP },
582
{ "remote", cmd_remote, RUN_SETUP },