git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Denton Liu <liu.denton@gmail.com>, Taylor Blau <me@ttaylorr.com>,
	Taylor Blau <ttaylorr@github.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	ZheNing Hu <adlternative@gmail.com>
Subject: Re: [PATCH v3] [GSOC][RFC] format-patch: pass --left-only to range-diff
Date: Fri, 12 Mar 2021 14:50:56 -0800	[thread overview]
Message-ID: <xmqqpn0456lr.fsf@gitster.g> (raw)
In-Reply-To: <pull.898.v3.git.1615285726482.gitgitgadget@gmail.com> (ZheNing Hu via GitGitGadget's message of "Tue, 09 Mar 2021 10:28:46 +0000")

"ZheNing Hu via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: ZheNing Hu <adlternative@gmail.com>
>
> In https://lore.kernel.org/git/YBx5rmVsg1LJhSKN@nand.local/,
> Taylor Blau proposing `git format-patch --cover-letter
> --range-diff` may mistakenly place upstream commit in the
> range-diff output. Teach `format-patch` pass `--left-only`
> to range-diff,can avoid this kind of mistake.

The above is a bit too dense for average readers to grok.  Even if
the readers refer to the external reference, it is unclear where the
"may mistakenly" can come from and why "--left-only" would be
useful (and our log message should not depend on external material
so heavily to begin with).

So let's think aloud to see what use case this may be helpful, and
how the proposed solution makes the world a better place.

If I understand correctly, the use case this tries to help is this:

 * You had sent the v1 iteration of topic.  It was in the range
   B1..T1 where B1 is the tip of the integration branch (like
   'master') from the upstream.

 * To prepare for the v2 iteration, not only you updated individual
   commits, you rebased the series on a new upstream.  Now the topic
   is in the range B2..T2, where B2 is the tip of the integration
   branch from the upstream, and it is very likely that B2 is a
   descendant of B1.

And you want to find out how your commits in T2 (new iteration)
compares with those in T1 (old iteration).  Normally,

    $ git range-diff T1...T2

would be the shortest-to-type and correct version but that is
invalidated because you rebased.

    ---o---B1--b---b---b---B2
            \               \
	     t---t---T1      s---s---s---T2

You'd have commits B1..T1 on the left hand side of the range-diff,
while the right hand side has not just B2..T2 but also commits in
the range B1..B2, too.

By using --left-only (i.e. show only those pair that maps from
commits in the left range), you can exclude the commits in the
B1..B2.

    $ git range-diff --left-only T1...T2

I however wonder what --left-only (Suppress commits that are missing
from the first range) would do to commits in range B2..T2 (they are
all yours) that are (1) added since the v1 iteration, or (2)
modified so drastically that no matching commit is found.  With the
right invocation, of course,

    $ git range-diff B1..T1 B2..T2

you would not have such a problem.  If 2 't's in B1..T1 correspond
to 2 of the 3 's's in B2..T2, at least the presense of the third 's'
that did not match would show up in the output, making it clear that
you have one more commit relative to the earlier iteration.  If use
of --left-only filters it out, the output may be misleading to the
readers, no?

I started writing (or "thinking aloud") hoping that I can help
coming up with a better log message to describe the problem being
solved, but I ended up with "does this make the system better?"

  reply	other threads:[~2021-03-12 22:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07  6:57 [PATCH] [GSOC][RFC] format-patch: pass --right-only to range-diff ZheNing Hu via GitGitGadget
2021-03-08 20:18 ` Taylor Blau
2021-03-09  7:28   ` ZheNing Hu
2021-03-12 21:55   ` Junio C Hamano
2021-03-12 22:09     ` Junio C Hamano
2021-03-09  8:33 ` [PATCH v2] [GSOC][RFC] format-patch: pass --left-only " ZheNing Hu via GitGitGadget
2021-03-09  9:00   ` Eric Sunshine
2021-03-09  9:35     ` ZheNing Hu
2021-03-09 10:28   ` [PATCH v3] " ZheNing Hu via GitGitGadget
2021-03-12 22:50     ` Junio C Hamano [this message]
2021-03-13  4:01       ` ZheNing Hu
2021-03-13 23:23         ` Junio C Hamano
2021-03-14  2:16           ` ZheNing Hu
2021-03-14  2:37             ` ZheNing Hu
2021-03-14  2:41               ` ZheNing Hu
2021-03-14  8:10     ` [PATCH v4] [GSOC] " ZheNing Hu via GitGitGadget

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=xmqqpn0456lr.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=adlternative@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=liu.denton@gmail.com \
    --cc=me@ttaylorr.com \
    --cc=sunshine@sunshineco.com \
    --cc=ttaylorr@github.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.
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).