Git development
 help / color / mirror / Atom feed
* [BUG] 'diff A...B' fails with multiple merge bases
@ 2010-07-10  1:15 Pickens, James E
  2010-07-12 23:30 ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Pickens, James E @ 2010-07-10  1:15 UTC (permalink / raw)
  To: git@vger.kernel.org

Hi,

The command 'git diff A...B' is supposed to be equivalent to 'git diff $(git
merge-base A B) B'.  But when there are multiple merge bases between A and B,
the former gives no output.  Here's a recipe to reproduce the problem:

    git init
    git commit --allow-empty -m 1
    git checkout -b A
    touch file1
    git add file1
    git commit -m A
    git checkout master
    touch file2
    git add file2
    git commit -m B
    git checkout -b B
    git merge A
    git checkout A
    git merge master
    git diff A...B
    git diff $(git merge-base A B) B

The diff commands at the end will give different results.  It bisects to:

commit b75271d93a9e4be960d53fc4f955802530e0e733
Author: Matt McCutchen <matt@mattmccutchen.net>
Date:   Fri Oct 10 21:56:15 2008 -0400

    "git diff <tree>{3,}": do not reverse order of arguments

    According to the message of commit 0fe7c1de16f71312e6adac4b85bddf0d62a47168,
    "git diff" with three or more trees expects the merged tree first followed by
    the parents, in order.  However, this command reversed the order of its
    arguments, resulting in confusing diffs.  A comment /* Again, the revs are all
    reverse */ suggested there was a reason for this, but I can't figure out the
    reason, so I removed the reversal of the arguments.  Test case included.


I verified that if I revert that commit, 'diff A...B' works as expected, but
test t4013-diff-various.sh fails.  The failing command is 'git diff master
master^ side'.  I don't understand what that command is supposed to do, so I
didn't go any further.

Am I right that this is a bug, and if so can someone help to address it?

James

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-07-13  1:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-10  1:15 [BUG] 'diff A...B' fails with multiple merge bases Pickens, James E
2010-07-12 23:30 ` Junio C Hamano
2010-07-13  0:20   ` Junio C Hamano
2010-07-13  0:25     ` Junio C Hamano
2010-07-13  0:41       ` Sverre Rabbelier
2010-07-13  0:45         ` Junio C Hamano
2010-07-13  0:49           ` Sverre Rabbelier
2010-07-13  0:55             ` Junio C Hamano
2010-07-13  1:12               ` Sverre Rabbelier
2010-07-13  1:16       ` Pickens, James E

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox