git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Cc: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Subject: Re: On-branch topic description support?
Date: Thu, 21 Jul 2022 13:01:16 -0700	[thread overview]
Message-ID: <xmqqa692grqr.fsf@gitster.g> (raw)
In-Reply-To: <20220721191349.kf3zx4tpwrjhzudt@nitro.local> (Konstantin Ryabitsev's message of "Thu, 21 Jul 2022 15:13:49 -0400")

Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:

> Hmm... well, it works great as long as you remember to always use
> --rebase-merges. The moment you forget to pass -r to "git rebase", your cover
> letter commit disappears, and I'm not sure this is going to work for what I am
> trying to do (which is to make the process of submitting patch series
> simpler). I know it's possible to configure git so that "git pull --rebase"
> preserves merges, but there doesn't appear to be a way to force "git rebase
> -i" to do the same without the -r flag. Also, "rebase -ir" looks really
> different when there is a tip merge commit, which will probably also be
> confusing to newbies just starting out with rebase workflows.
>
> So, I'm not sure that at this time this is objectively "better" than keeping
> the cover letter in an empty commit at the start of the series. :-/

Now you are discussing this on the git mailing list, you do not
necessarily have to take the existing behaviour of Git as given.  

For example, I do not think it is unreasonable to teach "git rebase
[-i]" to special case a certain merge commit in the rebased range
without any extra option, as long as the criteria to pick such a
special "merge" is specific and narrow enough (a two-parent merge M
whose tree matches that of one parent's tree (say M^1^{tree}), the
other parent (say M^2) is an immediate ancestor of the bottommost
commit of the range being rebased, or something like that).  And the
way you "special case" it does not have to be tied to the way the
"-r" option handles it, either.  

A possible design could go like this:

 * we recognize such a special merge commit;

 * we rebase the rest of the range, pretending as if that merge
   commit did not exist and instead its children are all direct
   child of one of its parent (say M^1), using the options given (so
   "-r" would affect how other merges in the rebased range is
   handled).

 * after everything is done, we create a new empty merge commit at
   the top, merging the bottom of the range and the tip of the range
   as its parents, using the log message from original M.  This can
   be done totally outside of the regular "rebase" machinery.

Such a change to existing behaviour is well within the scope of
"On-branch topic description support", I would think.

  reply	other threads:[~2022-07-21 20:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-20 23:40 On-branch topic description support? Junio C Hamano
2022-07-21  0:52 ` Shaoxuan Yuan
2022-07-21  5:25 ` Elijah Newren
2022-07-21  6:11   ` Junio C Hamano
2022-07-21 14:41   ` Konstantin Ryabitsev
2022-07-21 16:06   ` Philip Oakley
2022-07-21 17:29     ` Junio C Hamano
2022-07-21 14:53 ` Ævar Arnfjörð Bjarmason
2022-07-21 16:26   ` Konstantin Ryabitsev
2022-07-21 17:35     ` Junio C Hamano
2022-07-21 17:51       ` Ævar Arnfjörð Bjarmason
2022-07-21 17:16   ` Junio C Hamano
2022-07-21 17:49     ` Ævar Arnfjörð Bjarmason
2022-07-21 18:02       ` Junio C Hamano
2022-07-21 18:26         ` Konstantin Ryabitsev
2022-07-21 18:58           ` Ævar Arnfjörð Bjarmason
2022-07-21 19:13           ` Konstantin Ryabitsev
2022-07-21 20:01             ` Junio C Hamano [this message]
2022-07-21 20:19               ` Konstantin Ryabitsev
2022-07-21 20:48                 ` Junio C Hamano
2022-07-21 15:05 ` Junio C Hamano
2022-07-21 15:29   ` rsbecker
2022-07-21 15:39     ` Konstantin Ryabitsev
2022-07-21 15:57       ` rsbecker
2022-07-22  3:15 ` Bagas Sanjaya

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=xmqqa692grqr.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=konstantin@linuxfoundation.org \
    /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 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 NNTP newsgroup(s).