From: Junio C Hamano <gitster@pobox.com>
To: "Steven E. Harris" <seh@panix.com>
Cc: git@vger.kernel.org
Subject: Re: How does git follow branch history across a merge commit?
Date: Fri, 28 Aug 2009 17:01:16 -0700 [thread overview]
Message-ID: <7vy6p38p4j.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <831vmv5wh7.fsf@torus.sehlabs.com> (Steven E. Harris's message of "Fri\, 28 Aug 2009 19\:50\:44 -0400")
"Steven E. Harris" <seh@panix.com> writes:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> If you merge competition into your master, the resulting commit will
>> have your master as its first parent. If check out competition and
>> merge master in your example, the resulting merge will have
>> compatition as the first parent.
>
> I see, having run a few more experiments to confirm this.
>
> I missed the point that merge commits are not "predecessor neutral";
> they apparently have a bias indicating "/this branch/ received content
> from /that branch/ (or /those branches/)".
We are in principle pretty much neutral, but in certain places you
obviously cannot avoid tiebreaking. A commit object has to record parents
in a bytestream in its representation, and inevitably one parent must come
before another one.
You also must give your users some way to refer to each of its parents, so
naturally we count from one, and call them $it^ (== $it^1), $it^2, etc.
We do not have "$it^?" that lets you pick its parents at random, as we
haven't found a good use case for such a feature.
One place we tiebreak favoring earlier parents over later ones, even
though there is no logical reason to do so, is merge simplification [*1*].
When more than one parents have the same tree, with respect to pathspec
given, while traversing the history, we pick the earliest one, because
that is just as good as choosing one at random, and would give us a
reproducible result. For a similar reason, when blame follows a merge
from identical parents, it assigns blame to earlier parents.
And at the end-user workflow level, people tend to think "I merge others
work into mine", so the log family of commands have --first-parent option
to follow only that ancestry, but that logic kicks in only while browsing,
not while building histories.
[Footnote]
*1* If you do not know what a merge simplification is, refer to e.g.
http://gitster.livejournal.com/35628.html and notice there is a place
where we follow "a parent that is the same as the merge result".
next prev parent reply other threads:[~2009-08-29 0:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-28 22:37 How does git follow branch history across a merge commit? Steven E. Harris
2009-08-28 23:30 ` Junio C Hamano
2009-08-28 23:32 ` Junio C Hamano
2009-08-28 23:50 ` Steven E. Harris
2009-08-29 0:01 ` Junio C Hamano [this message]
2009-08-30 0:29 ` Steven E. Harris
2009-08-29 0:25 ` Björn Steinbrink
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=7vy6p38p4j.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=seh@panix.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.
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).