git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Our merge bases sometimes suck

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Jun 13, 2014, 22:14 UTC
Message-ID
<539B77D2.3020307@alum.mit.edu>
In-Reply-To
<539B1E59.1030604@gmail.com>
On 06/13/2014 05:52 PM, Jakub Narębski wrote:
Show 14 quoted lines
> 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.

Thanks for the information. This doesn't seem to be the case in git 2.0.0. For example, commit 8c0db2f519 in the git project is a merge with two merge bases:

$ git --version git version 2.0.0 $ c=8c0db2f5193153ea8a51bb45b0512c5a3889023b $ git merge-base --all $c^1 $c^2 a15f43312f6962959e8daa33df0cf5357852a4b8 9a0e6731c632c841cd2de9dec0b9091b2f10c6fd $ git diff $c^1...$c^2 | head -20

diff --git a/Documentation/git-rev-parse.txt
b/Documentation/git-rev-parse.txt
index d638bfc..29b5789 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -77,6 +77,14 @@ OPTIONS
 	path of the top-level directory relative to the current
 	directory (typically a sequence of "../", or an empty string).

+--git-dir::
+	Show `$GIT_DIR` if defined else show the path to the .git directory.
+
+--short, --short=number::
+	Instead of outputting the full SHA1 values of object names try to
+	abbriviate them to a shorter unique name. When no length is specified
+	7 is used. The minimum length is 4.
+
 --since=datestring, --after=datestring::
 	Parses the date string, and outputs corresponding
 	--max-age= parameter for git-rev-list command.
diff --git a/git-archimport.perl b/git-archimport.perl

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
Previous: Jakub NarębskiNext: Junio C Hamano
Message 5 of 12 in “Our merge bases sometimes suck”
  1. Michael HaggertyJun 12, 2014
  2. Michael J GruberJun 13, 2014
  3. Michael HaggertyJun 13, 2014
  4. Jakub NarębskiJun 13, 2014
  5. Michael HaggertyJun 13, 2014
  6. Junio C HamanoJun 13, 2014
  7. Junio C HamanoJun 17, 2014
  8. Michael HaggertyJun 17, 2014
  9. Junio C HamanoJun 20, 2014
  10. Michael HaggertyJun 20, 2014
  11. Nico WilliamsJun 20, 2014
  12. Jakub NarębskiJun 23, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.