From: Jonathan Nieder <jrnieder@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Andrew Pimlott" <andrew@pimlott.net>, git <git@vger.kernel.org>,
"Frédéric Brière" <fbriere@fbriere.net>,
"Michael J Gruber" <git@drmicha.warpmail.net>,
"Jeff King" <peff@peff.net>,
"Björn Steinbrink" <B.Steinbrink@gmx.de>
Subject: Re: [PATCH] Documentation: 'cherry' does not cope well with merges from upstream
Date: Thu, 1 Jul 2010 19:51:47 -0500 [thread overview]
Message-ID: <20100702005147.GA5962@burratino> (raw)
In-Reply-To: <7vbpaq3glt.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Example:
>>
>> o---o---F---X'---G---U [upstream]
>> \ \
>> X----Y---M---T [topic]
[...]
>> Consider the author of a different branch, also called ‘topic’, but
>> this one starts from commit G. Some infrastructure from an existing
>> branch is needed, so first she merges that. Then she adds her own
>> commit.
>
> Sorry, but it is unclear to me what kind of history you have in mind at
> this point. What "existing branch" are you talking about? Presumably it
> is not the [topic] in an earlier example, nor it is [upstream] right?
>
> o---o---o---o----G-------.---U [upstream]
> \ \
> X---Y---M---T
>
> Something like this?
Sorry for the lack of clarity. The "existing branch" was the history
ending at commit Y in the original picture. The resulting topic would
have the shape of the branch labelled [topic] in my diagram.
And except for the shapes being the same, this has nothing to do with
the earlier example.
What I was trying to get at with the two examples is that in histories
like the above, the concept of "fork point" is not well defined.
Where did topic fork from upstream? It could have been at G, or F, or
any other merge-base of upstream and topic for that matter; the
recorded history does not give enough information to say.
The choice of fork point might look like it is only for optimization,
but it affects the semantics, too.
Example: reviving a reverted patch
... o---F---P---R---G---o [upstream]
\
P' [alice]
Upstream, a certain patch (P) was accepted, found to introduce horrible
problems, and then reverted (R). Patch submitter Alice still believes
that is a good patch, though, so she creates a branch to start work on
it, cherry-picking the change (P'). ‘git cherry’ correctly reports
P' as not merged upstream; that it has the same patch-id as commit P
is simply irrelevant.
$ git cherry
+ P'
Alice might merge a branch with a fork point that does not have P as
an ancestor:
... o---o---P---R---G---o [upstream]
\ /
x
/ \
o P'
/ \
... o---o---o---F---o---M [alice]
How can ‘git cherry’ tell that the fork point was G? That
knowledge determines whether P' should be considered to be merged
upstream or not:
* If the fork point was F, then the patch for P' has been applied
upstream since then (indirectly through the merge of G).
* If the fork point is G, then the patch for P' was upstream all
along, and P' has no upstream analog since then.
In reality, ‘git cherry’ does not choose; instead of doing arithmetic
based on fork points, it just says _no_ commit reachable from the tip
of alice can be used as evidence that a patch from alice has been
merged.
Plenty of other heuristics are possible, but it is hard to find a
more intuitive efficient one. I suspect I would find it useful to be
able to explicitly set a commit ‘prefork’ and examine all commits
prefork..upstream in the search for evidence that a patch has been
merged.
next prev parent reply other threads:[~2010-07-02 0:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-01 19:38 git cherry not marking commits with equivalent upstream Andrew Pimlott
2010-07-01 19:40 ` Andrew Pimlott
2010-07-01 20:41 ` Björn Steinbrink
2010-07-01 21:17 ` Andrew Pimlott
2010-07-01 21:09 ` [PATCH] Documentation: 'cherry' does not cope well with merges from upstream Jonathan Nieder
2010-07-01 21:33 ` Andrew Pimlott
2010-07-01 21:35 ` Jonathan Nieder
2010-07-01 23:52 ` Junio C Hamano
2010-07-02 0:51 ` Jonathan Nieder [this message]
2010-07-02 1:04 ` Jonathan Nieder
2010-07-02 7:46 ` Michael J Gruber
2010-07-02 8:18 ` Jonathan Nieder
2010-07-02 9:23 ` Michael J Gruber
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=20100702005147.GA5962@burratino \
--to=jrnieder@gmail.com \
--cc=B.Steinbrink@gmx.de \
--cc=andrew@pimlott.net \
--cc=fbriere@fbriere.net \
--cc=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).