Git fork

"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.

Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

authored by

Matt McCutchen and committed by
Shawn O. Pearce
b75271d9 f285a2d7

+31 -3
+1 -3
builtin-diff.c
··· 177 177 if (!revs->dense_combined_merges && !revs->combine_merges) 178 178 revs->dense_combined_merges = revs->combine_merges = 1; 179 179 parent = xmalloc(ents * sizeof(*parent)); 180 - /* Again, the revs are all reverse */ 181 180 for (i = 0; i < ents; i++) 182 - hashcpy((unsigned char *)(parent + i), 183 - ent[ents - 1 - i].item->sha1); 181 + hashcpy((unsigned char *)(parent + i), ent[i].item->sha1); 184 182 diff_tree_combined(parent[0], parent + 1, ents - 1, 185 183 revs->dense_combined_merges, revs); 186 184 return 0;
+1
t/t4013-diff-various.sh
··· 258 258 diff --patch-with-raw -r initial..side 259 259 diff --name-status dir2 dir 260 260 diff --no-index --name-status dir2 dir 261 + diff master master^ side 261 262 EOF 262 263 263 264 test_done
+29
t/t4013/diff.diff_master_master^_side
··· 1 + $ git diff master master^ side 2 + diff --cc dir/sub 3 + index cead32e,7289e35..992913c 4 + --- a/dir/sub 5 + +++ b/dir/sub 6 + @@@ -1,6 -1,4 +1,8 @@@ 7 + A 8 + B 9 + +C 10 + +D 11 + +E 12 + +F 13 + + 1 14 + + 2 15 + diff --cc file0 16 + index b414108,f4615da..10a8a9f 17 + --- a/file0 18 + +++ b/file0 19 + @@@ -1,6 -1,6 +1,9 @@@ 20 + 1 21 + 2 22 + 3 23 + +4 24 + +5 25 + +6 26 + + A 27 + + B 28 + + C 29 + $