git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Jakub Narębski" <jnareb@gmail.com>
To: Michael J Gruber <git@drmicha.warpmail.net>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	git discussion list <git@vger.kernel.org>
Subject: Re: Our merge bases sometimes suck
Date: Fri, 13 Jun 2014 17:52:57 +0200	[thread overview]
Message-ID: <539B1E59.1030604@gmail.com> (raw)
In-Reply-To: <539AC690.6000906@drmicha.warpmail.net>

W dniu 2014-06-13 11:38, Michael J Gruber pisze:
> Michael Haggerty venit, vidit, dixit 13.06.2014 00:12:
>> I've been thinking a lot about merge bases lately and think I have
>> discovered something interesting.
>>
>> tl;dr:
>>
>> When two branches have multiple merge bases,
>>
>>      git merge-base $master $branch
>>
>> picks one merge base more or less arbitrarily.  Here I describe a
>> criterion for picking a "best" merge base.  When the best merge base
>> is used, the diff output by
>>
>>      git diff $master...$branch
>>
>> becomes shorter and simpler--sometimes dramatically so.  I have
>> quantified the improvement by analyzing historical merges from the Git
>> project (see attached image).  Best merge bases might also help reduce
>> conflicts when conducting merges.
>>
>
> Everytime I looked at our merge base code, my head started spinning. So
> it's admirable you even started this endeavor :)
>
> We use merge bases for several things:
>
> - merging
> - resolving "A...B" rev notation (rev-list and friends), aka symmetric
> difference
> - left/right selection/annotation of commits (rev-list/log)
> - resolving "diff A...B", which may be a handy notation, but is horribly
> misleading because it is a very unsymmetric form of diff

I don't know if it has been fixed, but there is a difference
between "git diff A...B" when A and B have one merge base, and
"git diff A...B" when there are more than one merge base.

When there is one merge base, "git diff A...B" returns simple
unified diff equivalent to "git diff $(git merge-base A B) B".
It is unsymmetric.

But where there are more than one merge base, by design or by
accident for "git diff A...B" git 1.9.2 / 1.7.4 returns

    git diff --cc $(git merge-base --all A B) A B

which is *symmetric*, and is combined not unified diff.

-- 
Jakub Narębski

  parent reply	other threads:[~2014-06-13 15:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 22:12 Our merge bases sometimes suck Michael Haggerty
2014-06-13  9:38 ` Michael J Gruber
2014-06-13 10:13   ` Michael Haggerty
2014-06-13 15:52   ` Jakub Narębski [this message]
2014-06-13 22:14     ` Michael Haggerty
2014-06-13 22:35     ` Junio C Hamano
2014-06-17 15:08 ` Junio C Hamano
2014-06-17 15:44   ` Michael Haggerty
2014-06-20  6:53     ` Junio C Hamano
2014-06-20  8:53       ` Michael Haggerty
2014-06-20 21:17       ` Nico Williams
2014-06-23 11:43         ` Jakub Narębski

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=539B1E59.1030604@gmail.com \
    --to=jnareb@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=mhagger@alum.mit.edu \
    /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).