All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <e@80x24.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2 5/7] rebase: drop support for `--preserve-merges`
Date: Wed, 01 Sep 2021 15:33:05 +0200	[thread overview]
Message-ID: <87tuj4v2q5.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <eb738b1bf05dceb1d119e3adcd732d968407c757.1630497435.git.gitgitgadget@gmail.com>


On Wed, Sep 01 2021, Johannes Schindelin via GitGitGadget wrote:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> This option was deprecated in favor of `--rebase-merges` some time ago,
> and now we retire it.

>  static int is_merge(struct rebase_options *opts)
>  {
> -	return opts->type == REBASE_MERGE ||
> -		opts->type == REBASE_PRESERVE_MERGES;
> +	return opts->type == REBASE_MERGE;
>  }

This leaves us with a rather pointless is_merge() function and
nonsensical control flow in parse_opt_merge(). Let's squash this in:

diff --git a/builtin/rebase.c b/builtin/rebase.c
index 4e19f64b91b..043933ab771 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -383,11 +383,6 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg,
 	return 0;
 }
 
-static int is_merge(struct rebase_options *opts)
-{
-	return opts->type == REBASE_MERGE;
-}
-
 static void imply_merge(struct rebase_options *opts, const char *option)
 {
 	switch (opts->type) {
@@ -909,8 +904,7 @@ static int parse_opt_merge(const struct option *opt, const char *arg, int unset)
 	BUG_ON_OPT_NEG(unset);
 	BUG_ON_OPT_ARG(arg);
 
-	if (!is_merge(opts))
-		opts->type = REBASE_MERGE;
+	opts->type = REBASE_MERGE;
 
 	return 0;
 }
@@ -988,7 +982,7 @@ static void set_reflog_action(struct rebase_options *options)
 	const char *env;
 	struct strbuf buf = STRBUF_INIT;
 
-	if (!is_merge(options))
+	if (options->type != REBASE_MERGE)
 		return;
 
 	env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
@@ -1208,12 +1202,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		die(_("No rebase in progress?"));
 	setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
 
-	if (action == ACTION_EDIT_TODO && !is_merge(&options))
+	if (action == ACTION_EDIT_TODO && options.type != REBASE_MERGE)
 		die(_("The --edit-todo action can only be used during "
 		      "interactive rebase."));
 
 	if (trace2_is_enabled()) {
-		if (is_merge(&options))
+		if (options.type == REBASE_MERGE)
 			trace2_cmd_mode("interactive");
 		else if (exec.nr)
 			trace2_cmd_mode("interactive-exec");
@@ -1465,7 +1459,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 				break;
 
 		if (i >= 0) {
-			if (is_merge(&options))
+			if (options.type == REBASE_MERGE)
 				die(_("cannot combine apply options with "
 				      "merge options"));
 			else
@@ -1507,7 +1501,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		else
 			options.empty = EMPTY_DROP;
 	}
-	if (reschedule_failed_exec > 0 && !is_merge(&options))
+	if (reschedule_failed_exec > 0 && options.type != REBASE_MERGE)
 		die(_("--reschedule-failed-exec requires "
 		      "--exec or --interactive"));
 	if (reschedule_failed_exec >= 0)
@@ -1746,7 +1740,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		diff_flush(&opts);
 	}
 
-	if (is_merge(&options))
+	if (options.type == REBASE_MERGE)
 		goto run_rebase;
 
 	/* Detach HEAD and reset the tree */

  parent reply	other threads:[~2021-09-01 13:34 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 [this message]
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     ` [PATCH v3 07/11] rebase: drop the internal `rebase--interactive` command Johannes Schindelin via GitGitGadget
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=87tuj4v2q5.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    /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.