git@vger.kernel.org list mirror (unofficial, one of many)
 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, Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2 1/1] rebase: deprecate --preserve-merges
Date: Thu, 02 May 2019 16:52:32 +0200
Message-ID: <87imusj4cv.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <f6990f28c028e04c5d237878d7fbb2160dd7dac9.1552334254.git.gitgitgadget@gmail.com>


On Mon, Mar 11 2019, Johannes Schindelin via GitGitGadget wrote:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> We have something much better now: --rebase-merges (which is a
> complete re-design --preserve-merges, with a lot of issues fixed such as
> the inability to reorder commits with --preserve-merges).
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>  Documentation/config/branch.txt |  6 +++---
>  Documentation/config/pull.txt   |  6 +++---
>  Documentation/git-rebase.txt    | 23 ++++++++++++-----------
>  builtin/rebase.c                |  8 ++++++--
>  4 files changed, 24 insertions(+), 19 deletions(-)
>
> diff --git a/Documentation/config/branch.txt b/Documentation/config/branch.txt
> index 019d60ede2..8f4b3faadd 100644
> --- a/Documentation/config/branch.txt
> +++ b/Documentation/config/branch.txt
> @@ -85,9 +85,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
>  so that the local merge commits are included in the rebase (see
>  linkgit:git-rebase[1] for details).
>  +
> -When preserve, also pass `--preserve-merges` along to 'git rebase'
> -so that locally committed merge commits will not be flattened
> -by running 'git pull'.
> +When `preserve` (deprecated in favor of `merges`), also pass
> +`--preserve-merges` along to 'git rebase' so that locally committed merge
> +commits will not be flattened by running 'git pull'.
>  +
>  When the value is `interactive`, the rebase is run in interactive mode.
>  +
> diff --git a/Documentation/config/pull.txt b/Documentation/config/pull.txt
> index bb23a9947d..b87cab31b3 100644
> --- a/Documentation/config/pull.txt
> +++ b/Documentation/config/pull.txt
> @@ -18,9 +18,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
>  so that the local merge commits are included in the rebase (see
>  linkgit:git-rebase[1] for details).
>  +
> -When preserve, also pass `--preserve-merges` along to 'git rebase'
> -so that locally committed merge commits will not be flattened
> -by running 'git pull'.
> +When `preserve` (deprecated in favor of `merges`), also pass
> +`--preserve-merges` along to 'git rebase' so that locally committed merge
> +commits will not be flattened by running 'git pull'.
>  +
>  When the value is `interactive`, the rebase is run in interactive mode.
>  +
> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
> index 6363d674b7..44e00329e1 100644
> --- a/Documentation/git-rebase.txt
> +++ b/Documentation/git-rebase.txt
> @@ -415,9 +415,9 @@ i.e. commits that would be excluded by linkgit:git-log[1]'s
>  the `rebase-cousins` mode is turned on, such commits are instead rebased
>  onto `<upstream>` (or `<onto>`, if specified).
>  +
> -The `--rebase-merges` mode is similar in spirit to `--preserve-merges`, but
> -in contrast to that option works well in interactive rebases: commits can be
> -reordered, inserted and dropped at will.
> +The `--rebase-merges` mode is similar in spirit to the deprecated
> +`--preserve-merges`, but in contrast to that option works well in interactive
> +rebases: commits can be reordered, inserted and dropped at will.
>  +
>  It is currently only possible to recreate the merge commits using the
>  `recursive` merge strategy; Different merge strategies can be used only via
> @@ -427,9 +427,10 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
>
>  -p::
>  --preserve-merges::
> -	Recreate merge commits instead of flattening the history by replaying
> -	commits a merge commit introduces. Merge conflict resolutions or manual
> -	amendments to merge commits are not preserved.
> +	[DEPRECATED: use `--rebase-merges` instead] Recreate merge commits
> +	instead of flattening the history by replaying commits a merge commit
> +	introduces. Merge conflict resolutions or manual amendments to merge
> +	commits are not preserved.
>  +
>  This uses the `--interactive` machinery internally, but combining it
>  with the `--interactive` option explicitly is generally not a good
> @@ -1020,11 +1021,11 @@ merge cmake
>
>  BUGS
>  ----
> -The todo list presented by `--preserve-merges --interactive` does not
> -represent the topology of the revision graph.  Editing commits and
> -rewording their commit messages should work fine, but attempts to
> -reorder commits tend to produce counterintuitive results. Use
> -`--rebase-merges` in such scenarios instead.
> +The todo list presented by the deprecated `--preserve-merges --interactive`
> +does not represent the topology of the revision graph (use `--rebase-merges`
> +instead).  Editing commits and rewording their commit messages should work
> +fine, but attempts to reorder commits tend to produce counterintuitive results.
> +Use `--rebase-merges` in such scenarios instead.
>
>  For example, an attempt to rearrange
>  ------------
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index 52114cbf0d..21ac10f739 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1100,8 +1100,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  			PARSE_OPT_NOARG | PARSE_OPT_NONEG,
>  			parse_opt_interactive },
>  		OPT_SET_INT('p', "preserve-merges", &options.type,
> -			    N_("try to recreate merges instead of ignoring "
> -			       "them"), REBASE_PRESERVE_MERGES),
> +			    N_("(DEPRECATED) try to recreate merges instead of "
> +			       "ignoring them"), REBASE_PRESERVE_MERGES),
>  		OPT_BOOL(0, "rerere-autoupdate",
>  			 &options.allow_rerere_autoupdate,
>  			 N_("allow rerere to update index with resolved "
> @@ -1212,6 +1212,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
>  		usage_with_options(builtin_rebase_usage,
>  				   builtin_rebase_options);
>
> +	if (options.type == REBASE_PRESERVE_MERGES)
> +		warning(_("git rebase --preserve-merges is deprecated. "
> +			  "Use --rebase-merges instead."));
> +
>  	if (action != NO_ACTION && !in_progress)
>  		die(_("No rebase in progress?"));
>  	setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);

An internal user reported the following "bug" they ran into:

 1. They ran "git pull --rebase=preserve"
 2. warning: git rebase --preserve-merges is deprecated. Use --rebase-merges instead.

This is very confusing, since the user issued "--rebase=preserve", *not*
"--preserve-merges".

We could detect that we came from "git pull" and pass down the argv we
used blah blah, but how about just describing things a bit more in the
warning, e.g.:

    warning: the "preserve" backend for 'git rebase' has been
    deprecated. You invoked git with "rebase --preserve-merges", either
    directly, or via "pull --rebase=preserve".

    Use the new "rebase merges" backend of "git rebase" instead, invoked
    via "rebase --rebase-merges" or "pull --rebase=merges". Note that
    the new backend may yield different results, see the "git rebase"
    documentation for details.

  reply	other threads:[~2019-05-02 14:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-07 10:00 [PATCH 0/1] Deprecate git rebase --preserve-merges Johannes Schindelin via GitGitGadget
2019-03-07 10:00 ` [PATCH 1/1] rebase: deprecate --preserve-merges Johannes Schindelin via GitGitGadget
2019-03-07 16:25   ` Phillip Wood
2019-03-11 19:31     ` Johannes Schindelin
2019-03-07 16:47   ` Eric Sunshine
2019-03-11 19:33     ` Johannes Schindelin
2019-03-11 19:57 ` [PATCH v2 0/1] Deprecate git rebase --preserve-merges Johannes Schindelin via GitGitGadget
2019-03-11 19:57   ` [PATCH v2 1/1] rebase: deprecate --preserve-merges Johannes Schindelin via GitGitGadget
2019-05-02 14:52     ` Ævar Arnfjörð Bjarmason [this message]
2019-05-09 14:36       ` Johannes Schindelin

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=87imusj4cv.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git