git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Kevin Daudt <me@ikke.info>
Cc: Robin Moussu <moussu.robin@pm.me>,
	"git\@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Inconsistancy with `git rebase --preserve-merges`
Date: Mon, 24 Feb 2020 13:35:59 -0800	[thread overview]
Message-ID: <xmqqlforoegw.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20200224183648.GF1247035@alpha> (Kevin Daudt's message of "Mon, 24 Feb 2020 19:36:48 +0100")

Kevin Daudt <me@ikke.info> writes:

>> $ git rebase --preserve-merges -i 412f07a~
>
> Can you try `--rebase-merges` instead? Since v2.22.0 `--preseve-merges`
> is officially deprecated, but even before that it was already known to
> have flaws.

The options to "rebase" command seem to follow the usual "last one
wins" pattern.  There is a single opts->type field, and upon seeing
--preserve-merges, the field gets assigned REBASE_PRESERVE_MERGES,
and then when the command line option parser sees "-i", the field
gets overwritten by assigning REBASE_INTERACTIVE.  So

    git rebase --preserve-merges -i 412f07a~
    git rebase -i 412f07a~

both should do the same thing.

I suspect that "--rebase-merges -i" may hide the real issue (which
is "the command line option parsing of rebase is messy"), but it may
deserve to be cleaned up, now that the result of "rewrite it in C"
efforts seems to have sufficiently stablized.

What to clean-up?  There could be two-and-half ways to view it:

 * The options should follow the usual "last one wins" pattern; if
   we take this stance, what happens with "--rebase-merges -i" is
   buggy and "--preserve-merges -i" that behaves as a mere "-i" is
   doing the right thing.  The part of the command line parser that
   implements "--rebase-merges" should be fixed so that its effect
   gets reverted when "-i" is seen later.

 * The options "--rebase-merges" and "--perserve-merges" (there may
   be others) and "--interactive" should be mutually exclusive; if
   we take this stance, we should error out when we see two or more
   of them on the command line.

 * The options "--rebase-merges" and "--preserve-merges" (there may
   be others) should be mutually exclusive or "last one wins", but
   "--interactive" can be combined with them to make them
   interactive.

I am not sure which one is the best.  The impression I got from the
current state of the code is that it started from "last one wins",
and the code wanted to transition to "--interactive makes other
options go interactive" but hasn't done a good job by leaving loose
ends (like what we saw with "--preserve-merges"), so perhaps the
last one is what we want to aim as a long term solution?  I dunno.


      reply	other threads:[~2020-02-24 21:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <v9k9hyJjfgQYYIczd9NqrjSdyOyxwqEB0iWyQ_TZCnobCZZoZ8_v6WB4KcWyW5xxRPdDUyEqEYfXylOnGI57CtK9KegMgp_0bz_5RrIIhHY=@pm.me>
2020-02-24 14:10 ` Inconsistancy with `git rebase --preserve-merges` Robin Moussu
2020-02-24 18:36   ` Kevin Daudt
2020-02-24 21:35     ` Junio C Hamano [this message]

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=xmqqlforoegw.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@ikke.info \
    --cc=moussu.robin@pm.me \
    /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.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).