Reputation: 302643
I am on a branch, br
, which is pushed as origin/br
, on which I've made several several commits. In the case where HEAD
== br
== origin/br
, I am running these two commands:
(1) git diff <some-commit>
and
(2) git diff <some-commit> HEAD origin/br
where HEAD
is a direct descendant from <some-commit>
The two give different results, and while I understand that what (1)
does I have no idea what (2)
is printing. What does (2)
do? I believe it has something to do with this entry from the man page, but I do not know what it means:
<path>... The <paths> parameters, when given, are used to limit the diff to the named paths (you can give directory names and get diff for all files under them).
Upvotes: 1
Views: 211
Reputation: 60235
I'm betting the output is showing you diff -cc $pathname
and index $sha1,$sha2..$sha3
where sometimes two of sha's 1,2,3 are the same, and from some quick digging I think git's probably treating one of the commits (the middle, it looks like) as an explicit merge base, the other two as explicit merge tips -- but according to this from builtin/diff.c
the arguments you're passing are not correct.
/*
* We could get N tree-ish in the rev.pending_objects list.
* Also there could be M blobs there, and P pathspecs.
*
* N=0, M=0:
* cache vs files (diff-files)
* N=0, M=2:
* compare two random blobs. P must be zero.
* N=0, M=1, P=1:
* compare a blob with a working tree file.
*
* N=1, M=0:
* tree vs cache (diff-index --cached)
*
* N=2, M=0:
* tree vs tree (diff-tree)
*
* N=0, M=0, P=2:
* compare two filesystem entities (aka --no-index).
*
* Other cases are errors.
*/
Upvotes: 1