summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3927bbe)
raw | patch | inline | side by side (parent: 3927bbe)
author | Matt McCutchen <matt@mattmccutchen.net> | |
Sat, 11 Oct 2008 01:56:15 +0000 (21:56 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 7 Dec 2008 22:57:57 +0000 (14:57 -0800) |
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>
"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>
builtin-diff.c | patch | blob | history | |
t/t4013-diff-various.sh | patch | blob | history | |
t/t4013/diff.diff_master_master^_side | [new file with mode: 0644] | patch | blob |
diff --git a/builtin-diff.c b/builtin-diff.c
index 26cf6785918300f3a0998a1811adb71ec6ec7b73..375a0d33022dc5ce137ef46feff0486eee92e675 100644 (file)
--- a/builtin-diff.c
+++ b/builtin-diff.c
if (!revs->dense_combined_merges && !revs->combine_merges)
revs->dense_combined_merges = revs->combine_merges = 1;
parent = xmalloc(ents * sizeof(*parent));
- /* Again, the revs are all reverse */
for (i = 0; i < ents; i++)
- hashcpy((unsigned char *)(parent + i),
- ent[ents - 1 - i].item->sha1);
+ hashcpy((unsigned char *)(parent + i), ent[i].item->sha1);
diff_tree_combined(parent[0], parent + 1, ents - 1,
revs->dense_combined_merges, revs);
return 0;
index 9337b81064bbdbe4e7f590830b458c48226c4a17..99d9e0ba1309e7bb0e383ad72c53c6fe359e550e 100755 (executable)
--- a/t/t4013-diff-various.sh
+++ b/t/t4013-diff-various.sh
diff --patch-with-raw -r initial..side
diff --name-status dir2 dir
diff --no-index --name-status dir2 dir
+diff master master^ side
EOF
test_done
diff --git a/t/t4013/diff.diff_master_master^_side b/t/t4013/diff.diff_master_master^_side
--- /dev/null
@@ -0,0 +1,29 @@
+$ git diff master master^ side
+diff --cc dir/sub
+index cead32e,7289e35..992913c
+--- a/dir/sub
++++ b/dir/sub
+@@@ -1,6 -1,4 +1,8 @@@
+ A
+ B
+ +C
+ +D
+ +E
+ +F
++ 1
++ 2
+diff --cc file0
+index b414108,f4615da..10a8a9f
+--- a/file0
++++ b/file0
+@@@ -1,6 -1,6 +1,9 @@@
+ 1
+ 2
+ 3
+ +4
+ +5
+ +6
++ A
++ B
++ C
+$