[BUG] 'diff A...B' fails with multiple merge bases
From: Pickens, James E <hidden>
Date: 2016-06-15 22:49:06
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 [off-list ref]
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