git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: git discussion list <git@vger.kernel.org>
Subject: Re: Our merge bases sometimes suck
Date: Tue, 17 Jun 2014 08:08:17 -0700	[thread overview]
Message-ID: <xmqq8uovo9pa.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <539A25BF.4060501@alum.mit.edu> (Michael Haggerty's message of "Fri, 13 Jun 2014 00:12:15 +0200")

Michael Haggerty <mhagger@alum.mit.edu> writes:

> The "best" merge base
> =====================
>
> But not all merge bases are created equal.  It is possible to define a
> "best" merge base that has some nice properties.
>
> Let's focus on the command
>
>     git diff $master...$branch
>
> which is equivalent to
>
>     git diff $(git merge-base $master $branch)..$branch
> ...
> I propose that the best merge base is the merge base "candidate" that
> minimizes the number of non-merge commits that are in
>
>     git rev-list --no-merges $candidate..$branch
>
> but are already in master:
>
>     git rev-list --no-merges $master

I welcome this line of thought very much.

There is one niggle I find somewhat curious but am either too lazy
or too stupid to think it through myself ;-)

The "merge-base" is a symmetric operation, because the three-way
merge, which is the primary customer of its result, fundamentally
is.  From your description, it sounds like the "best" merge base
however may not be symmetric at all.  The merge-base between A and B
that makes "git diff A...B" the easiest to read by minimizing the
distance between it and B may be different from the merge-base
between A and B that makes the other diff "git diff B...A" the
easiest to read.

Or it may not be assymmetric---that is why I said I didn't think it
through.  I am not saying that it is bad if the "best" merge-base is
an asymmetric concept; I am curious if it is asymmetric, and if so
if that is fundamental.

  parent reply	other threads:[~2014-06-17 15:08 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
2014-06-13 22:14     ` Michael Haggerty
2014-06-13 22:35     ` Junio C Hamano
2014-06-17 15:08 ` Junio C Hamano [this message]
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=xmqq8uovo9pa.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --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).