All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: "Eric Wong" <e@80x24.org>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Johannes Sixt" <j6t@kdbg.org>,
	"Alban Gruin" <alban.gruin@gmail.com>,
	"Phillip Wood" <phillip.wood123@gmail.com>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: [PATCH v3 07/11] rebase: drop the internal `rebase--interactive` command
Date: Tue, 07 Sep 2021 21:05:08 +0000	[thread overview]
Message-ID: <b5a16e205e6c1fd4e888438c13bab9b7d992b7e9.1631048713.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.195.v3.git.1631048712.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 builtin/rebase.c | 193 +----------------------------------------------
 git.c            |   1 -
 2 files changed, 1 insertion(+), 193 deletions(-)

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 5f8d9f89ba4..0935e8d6e83 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -162,12 +162,7 @@ enum action {
 	ACTION_ABORT,
 	ACTION_QUIT,
 	ACTION_EDIT_TODO,
-	ACTION_SHOW_CURRENT_PATCH,
-	ACTION_SHORTEN_OIDS,
-	ACTION_EXPAND_OIDS,
-	ACTION_CHECK_TODO_LIST,
-	ACTION_REARRANGE_SQUASH,
-	ACTION_ADD_EXEC
+	ACTION_SHOW_CURRENT_PATCH
 };
 
 static const char *action_names[] = { "undefined",
@@ -178,81 +173,6 @@ static const char *action_names[] = { "undefined",
 				      "edit_todo",
 				      "show_current_patch" };
 
-static int add_exec_commands(struct string_list *commands)
-{
-	const char *todo_file = rebase_path_todo();
-	struct todo_list todo_list = TODO_LIST_INIT;
-	int res;
-
-	if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
-		return error_errno(_("could not read '%s'."), todo_file);
-
-	if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
-					&todo_list)) {
-		todo_list_release(&todo_list);
-		return error(_("unusable todo list: '%s'"), todo_file);
-	}
-
-	todo_list_add_exec_commands(&todo_list, commands);
-	res = todo_list_write_to_file(the_repository, &todo_list,
-				      todo_file, NULL, NULL, -1, 0);
-	todo_list_release(&todo_list);
-
-	if (res)
-		return error_errno(_("could not write '%s'."), todo_file);
-	return 0;
-}
-
-static int rearrange_squash_in_todo_file(void)
-{
-	const char *todo_file = rebase_path_todo();
-	struct todo_list todo_list = TODO_LIST_INIT;
-	int res = 0;
-
-	if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
-		return error_errno(_("could not read '%s'."), todo_file);
-	if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
-					&todo_list)) {
-		todo_list_release(&todo_list);
-		return error(_("unusable todo list: '%s'"), todo_file);
-	}
-
-	res = todo_list_rearrange_squash(&todo_list);
-	if (!res)
-		res = todo_list_write_to_file(the_repository, &todo_list,
-					      todo_file, NULL, NULL, -1, 0);
-
-	todo_list_release(&todo_list);
-
-	if (res)
-		return error_errno(_("could not write '%s'."), todo_file);
-	return 0;
-}
-
-static int transform_todo_file(unsigned flags)
-{
-	const char *todo_file = rebase_path_todo();
-	struct todo_list todo_list = TODO_LIST_INIT;
-	int res;
-
-	if (strbuf_read_file(&todo_list.buf, todo_file, 0) < 0)
-		return error_errno(_("could not read '%s'."), todo_file);
-
-	if (todo_list_parse_insn_buffer(the_repository, todo_list.buf.buf,
-					&todo_list)) {
-		todo_list_release(&todo_list);
-		return error(_("unusable todo list: '%s'"), todo_file);
-	}
-
-	res = todo_list_write_to_file(the_repository, &todo_list, todo_file,
-				      NULL, NULL, -1, flags);
-	todo_list_release(&todo_list);
-
-	if (res)
-		return error_errno(_("could not write '%s'."), todo_file);
-	return 0;
-}
-
 static int edit_todo_file(unsigned flags)
 {
 	const char *todo_file = rebase_path_todo();
@@ -402,7 +322,6 @@ static int run_sequencer_rebase(struct rebase_options *opts,
 	flags |= opts->rebase_merges ? TODO_LIST_REBASE_MERGES : 0;
 	flags |= opts->rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0;
 	flags |= opts->root_with_onto ? TODO_LIST_ROOT_WITH_ONTO : 0;
-	flags |= command == ACTION_SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0;
 	flags |= opts->reapply_cherry_picks ? TODO_LIST_REAPPLY_CHERRY_PICKS : 0;
 
 	switch (command) {
@@ -437,24 +356,6 @@ static int run_sequencer_rebase(struct rebase_options *opts,
 
 		break;
 	}
-	case ACTION_SHORTEN_OIDS:
-	case ACTION_EXPAND_OIDS:
-		ret = transform_todo_file(flags);
-		break;
-	case ACTION_CHECK_TODO_LIST:
-		ret = check_todo_list_from_file(the_repository);
-		break;
-	case ACTION_REARRANGE_SQUASH:
-		ret = rearrange_squash_in_todo_file();
-		break;
-	case ACTION_ADD_EXEC: {
-		struct string_list commands = STRING_LIST_INIT_DUP;
-
-		split_exec_commands(opts->cmd, &commands);
-		ret = add_exec_commands(&commands);
-		string_list_clear(&commands, 0);
-		break;
-	}
 	default:
 		BUG("invalid command '%d'", command);
 	}
@@ -476,98 +377,6 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg,
 	return 0;
 }
 
-static const char * const builtin_rebase_interactive_usage[] = {
-	N_("git rebase--interactive [<options>]"),
-	NULL
-};
-
-int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
-{
-	struct rebase_options opts = REBASE_OPTIONS_INIT;
-	struct object_id squash_onto = *null_oid();
-	enum action command = ACTION_NONE;
-	struct option options[] = {
-		OPT_NEGBIT(0, "ff", &opts.flags, N_("allow fast-forward"),
-			   REBASE_FORCE),
-		OPT_CALLBACK_F('k', "keep-empty", &options, NULL,
-			N_("keep commits which start empty"),
-			PARSE_OPT_NOARG | PARSE_OPT_HIDDEN,
-			parse_opt_keep_empty),
-		OPT_BOOL_F(0, "allow-empty-message", &opts.allow_empty_message,
-			   N_("allow commits with empty messages"),
-			   PARSE_OPT_HIDDEN),
-		OPT_BOOL(0, "rebase-merges", &opts.rebase_merges, N_("rebase merge commits")),
-		OPT_BOOL(0, "rebase-cousins", &opts.rebase_cousins,
-			 N_("keep original branch points of cousins")),
-		OPT_BOOL(0, "autosquash", &opts.autosquash,
-			 N_("move commits that begin with squash!/fixup!")),
-		OPT_BOOL(0, "signoff", &opts.signoff, N_("sign commits")),
-		OPT_BIT('v', "verbose", &opts.flags,
-			N_("display a diffstat of what changed upstream"),
-			REBASE_NO_QUIET | REBASE_VERBOSE | REBASE_DIFFSTAT),
-		OPT_CMDMODE(0, "continue", &command, N_("continue rebase"),
-			    ACTION_CONTINUE),
-		OPT_CMDMODE(0, "skip", &command, N_("skip commit"), ACTION_SKIP),
-		OPT_CMDMODE(0, "edit-todo", &command, N_("edit the todo list"),
-			    ACTION_EDIT_TODO),
-		OPT_CMDMODE(0, "show-current-patch", &command, N_("show the current patch"),
-			    ACTION_SHOW_CURRENT_PATCH),
-		OPT_CMDMODE(0, "shorten-ids", &command,
-			N_("shorten commit ids in the todo list"), ACTION_SHORTEN_OIDS),
-		OPT_CMDMODE(0, "expand-ids", &command,
-			N_("expand commit ids in the todo list"), ACTION_EXPAND_OIDS),
-		OPT_CMDMODE(0, "check-todo-list", &command,
-			N_("check the todo list"), ACTION_CHECK_TODO_LIST),
-		OPT_CMDMODE(0, "rearrange-squash", &command,
-			N_("rearrange fixup/squash lines"), ACTION_REARRANGE_SQUASH),
-		OPT_CMDMODE(0, "add-exec-commands", &command,
-			N_("insert exec commands in todo list"), ACTION_ADD_EXEC),
-		{ OPTION_CALLBACK, 0, "onto", &opts.onto, N_("onto"), N_("onto"),
-		  PARSE_OPT_NONEG, parse_opt_commit, 0 },
-		{ OPTION_CALLBACK, 0, "restrict-revision", &opts.restrict_revision,
-		  N_("restrict-revision"), N_("restrict revision"),
-		  PARSE_OPT_NONEG, parse_opt_commit, 0 },
-		{ OPTION_CALLBACK, 0, "squash-onto", &squash_onto, N_("squash-onto"),
-		  N_("squash onto"), PARSE_OPT_NONEG, parse_opt_object_id, 0 },
-		{ OPTION_CALLBACK, 0, "upstream", &opts.upstream, N_("upstream"),
-		  N_("the upstream commit"), PARSE_OPT_NONEG, parse_opt_commit,
-		  0 },
-		OPT_STRING(0, "head-name", &opts.head_name, N_("head-name"), N_("head name")),
-		{ OPTION_STRING, 'S', "gpg-sign", &opts.gpg_sign_opt, N_("key-id"),
-			N_("GPG-sign commits"),
-			PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
-		OPT_STRING(0, "strategy", &opts.strategy, N_("strategy"),
-			   N_("rebase strategy")),
-		OPT_STRING(0, "strategy-opts", &opts.strategy_opts, N_("strategy-opts"),
-			   N_("strategy options")),
-		OPT_STRING(0, "switch-to", &opts.switch_to, N_("switch-to"),
-			   N_("the branch or commit to checkout")),
-		OPT_STRING(0, "onto-name", &opts.onto_name, N_("onto-name"), N_("onto name")),
-		OPT_STRING(0, "cmd", &opts.cmd, N_("cmd"), N_("the command to run")),
-		OPT_RERERE_AUTOUPDATE(&opts.allow_rerere_autoupdate),
-		OPT_BOOL(0, "reschedule-failed-exec", &opts.reschedule_failed_exec,
-			 N_("automatically re-schedule any `exec` that fails")),
-		OPT_END()
-	};
-
-	opts.rebase_cousins = -1;
-
-	if (argc == 1)
-		usage_with_options(builtin_rebase_interactive_usage, options);
-
-	argc = parse_options(argc, argv, prefix, options,
-			builtin_rebase_interactive_usage, PARSE_OPT_KEEP_ARGV0);
-
-	if (!is_null_oid(&squash_onto))
-		opts.squash_onto = &squash_onto;
-
-	if (opts.rebase_cousins >= 0 && !opts.rebase_merges)
-		warning(_("--[no-]rebase-cousins has no effect without "
-			  "--rebase-merges"));
-
-	return !!run_sequencer_rebase(&opts, command);
-}
-
 static int is_merge(struct rebase_options *opts)
 {
 	return opts->type == REBASE_MERGE;
diff --git a/git.c b/git.c
index 18bed9a9964..268cdd82cfc 100644
--- a/git.c
+++ b/git.c
@@ -577,7 +577,6 @@ static struct cmd_struct commands[] = {
 	{ "range-diff", cmd_range_diff, RUN_SETUP | USE_PAGER },
 	{ "read-tree", cmd_read_tree, RUN_SETUP | SUPPORT_SUPER_PREFIX},
 	{ "rebase", cmd_rebase, RUN_SETUP | NEED_WORK_TREE },
-	{ "rebase--interactive", cmd_rebase__interactive, RUN_SETUP | NEED_WORK_TREE },
 	{ "receive-pack", cmd_receive_pack },
 	{ "reflog", cmd_reflog, RUN_SETUP },
 	{ "remote", cmd_remote, RUN_SETUP },
-- 
gitgitgadget


  parent reply	other threads:[~2021-09-07 21:05 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-23 20:50 [PATCH 0/8] Drop support for git rebase --preserve-merges Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 1/8] t5520: do not use `pull.rebase=preserve` Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 2/8] remote: warn about unhandled branch.<name>.rebase values Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 3/8] tests: stop testing `git rebase --preserve-merges` Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 4/8] pull: remove support for `--rebase=preserve` Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 5/8] rebase: drop support for `--preserve-merges` Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 6/8] git-svn: " Johannes Schindelin via GitGitGadget
2019-11-23 22:08   ` Eric Wong
2019-11-24 21:29     ` Johannes Schindelin
2019-11-25  3:15       ` Eric Wong
2019-11-23 20:50 ` [PATCH 7/8] rebase: drop the internal `rebase--interactive` command Johannes Schindelin via GitGitGadget
2019-11-23 20:50 ` [PATCH 8/8] remote: no longer claim that branch.*.rebase=preserve is a thing Johannes Schindelin via GitGitGadget
2021-09-01 11:57 ` [PATCH v2 0/7] Drop support for git rebase --preserve-merges Johannes Schindelin via GitGitGadget
2021-09-01 11:57   ` [PATCH v2 1/7] t5520: do not use `pull.rebase=preserve` Johannes Schindelin via GitGitGadget
2021-09-01 11:57   ` [PATCH v2 2/7] remote: warn about unhandled branch.<name>.rebase values Johannes Schindelin via GitGitGadget
2021-09-01 11:57   ` [PATCH v2 3/7] tests: stop testing `git rebase --preserve-merges` Johannes Schindelin via GitGitGadget
2021-09-01 13:26     ` Ævar Arnfjörð Bjarmason
2021-09-01 11:57   ` [PATCH v2 4/7] pull: remove support for `--rebase=preserve` Johannes Schindelin via GitGitGadget
2021-09-01 11:57   ` [PATCH v2 5/7] rebase: drop support for `--preserve-merges` Johannes Schindelin via GitGitGadget
2021-09-01 12:21     ` Ævar Arnfjörð Bjarmason
2021-09-02 13:54       ` Johannes Schindelin
2021-09-02 14:11         ` Ævar Arnfjörð Bjarmason
2021-09-01 13:33     ` Ævar Arnfjörð Bjarmason
2021-09-02 13:59       ` Johannes Schindelin
2021-09-02 14:16         ` Ævar Arnfjörð Bjarmason
2021-09-02 14:28     ` Ævar Arnfjörð Bjarmason
2021-09-02 14:34     ` Ævar Arnfjörð Bjarmason
2021-09-02 14:56       ` Ævar Arnfjörð Bjarmason
2021-09-02 15:34         ` Ævar Arnfjörð Bjarmason
2021-09-04 19:41       ` Johannes Schindelin
2021-09-05  7:32         ` Ævar Arnfjörð Bjarmason
2021-09-05 22:36           ` Junio C Hamano
2021-09-06 10:15     ` Phillip Wood
2021-09-07 12:32       ` Johannes Schindelin
2021-09-07 15:31         ` Phillip Wood
2021-09-07 19:44           ` Johannes Schindelin
2021-09-01 11:57   ` [PATCH v2 6/7] git-svn: " Johannes Schindelin via GitGitGadget
2021-09-01 13:25     ` Ævar Arnfjörð Bjarmason
2021-09-02 14:00       ` Johannes Schindelin
2021-09-02 14:08       ` Johannes Schindelin
2021-09-01 11:57   ` [PATCH v2 7/7] rebase: drop the internal `rebase--interactive` command Johannes Schindelin via GitGitGadget
2021-09-06 10:10     ` Phillip Wood
2021-09-07 12:39       ` Johannes Schindelin
2021-09-01 13:37   ` [PATCH v2 0/7] Drop support for git rebase --preserve-merges Ævar Arnfjörð Bjarmason
2021-09-02 14:16     ` Johannes Schindelin
2021-09-02 14:51       ` Ævar Arnfjörð Bjarmason
2021-09-01 22:25   ` Junio C Hamano
2021-09-02 14:18     ` Johannes Schindelin
2021-09-02 20:06       ` Johannes Sixt
2021-09-07 17:33         ` Johannes Schindelin
2021-09-07 22:48           ` Elijah Newren
2021-09-10 12:08             ` Johannes Schindelin
2021-09-10 17:16               ` Elijah Newren
2021-09-13 11:24                 ` merge-ort and --rebase-merges, was " Johannes Schindelin
2021-09-13 15:53                   ` Elijah Newren
2021-09-06  6:58     ` Ævar Arnfjörð Bjarmason
2021-09-07 18:27       ` Junio C Hamano
2021-09-07 19:52         ` Ævar Arnfjörð Bjarmason
2021-09-04 22:30   ` Alban Gruin
2021-09-06 10:17     ` Phillip Wood
2021-09-07 12:48     ` Johannes Schindelin
2021-09-07 21:05   ` [PATCH v3 00/11] " Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 01/11] t5520: do not use `pull.rebase=preserve` Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 02/11] remote: warn about unhandled branch.<name>.rebase values Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 03/11] tests: stop testing `git rebase --preserve-merges` Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 04/11] pull: remove support for `--rebase=preserve` Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 05/11] rebase: drop support for `--preserve-merges` Johannes Schindelin via GitGitGadget
2021-09-10 14:53       ` Ævar Arnfjörð Bjarmason
2022-07-21 19:02       ` re-mentioning --preserve-merges in the docs (was: [PATCH v3 05/11] rebase: drop support for `--preserve-merges`) Ævar Arnfjörð Bjarmason
2022-07-21 20:15         ` re-mentioning --preserve-merges in the docs Junio C Hamano
2022-07-29 13:24           ` Johannes Schindelin
2021-09-07 21:05     ` [PATCH v3 06/11] git-svn: drop support for `--preserve-merges` Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` Johannes Schindelin via GitGitGadget [this message]
2021-09-07 21:05     ` [PATCH v3 08/11] rebase: remove obsolete code comment Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 09/11] rebase: stop mentioning the -p option in comments Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 10/11] rebase: remove a no-longer-used function Johannes Schindelin via GitGitGadget
2021-09-07 21:05     ` [PATCH v3 11/11] sequencer: restrict scope of a formerly public function Johannes Schindelin via GitGitGadget
2021-09-08  1:30     ` [PATCH v3 00/11] Drop support for git rebase --preserve-merges Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b5a16e205e6c1fd4e888438c13bab9b7d992b7e9.1631048713.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=alban.gruin@gmail.com \
    --cc=avarab@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=phillip.wood123@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.