Re: git-diff-tree -B broken

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Petr Baudis <pasky@xxxxxx> writes:

> 	$ git-diff-tree -r -p -B -M 916d8240bfc8ef5b80780b1a32ebb83ed055a178 \
> 		3c9324ea16c345fc0bc0f11041905ba714797e4a cg-mkpatch
> 	diff --git a/cg-mkpatch b/cg-mkpatch
> 	dissimilarity index 57%
> 	index 74fe917..c932bc9 100755
> 	--- cg-mkpatch
> 	+++ cg-mkpatch
> 	@@ -0,0 +0,0 @@
>
> and nothing else. I'm too tired to debug or bisect this (xdiff
> introduction is the obvious suspect, I guess), just didn't want this
> to slip into the looming 1.3.0 so reporting early.

Thanks.

There are two issues.  One of them is addressed with the
attached patch, which is just an artifact of the xdiff
introduction.

Another issue is a bit bigger.

The changes to the sample cg-mkpatch is estimated to be big
enough to get broken, just in case if there is another file
whose postimage that is more similar than the postimage of
cg-mkpatch itself, so that it can be matched up with the other
file, but it is _not_ dissimilar enough that diffcore_break()
code marks it to be merged back together if pieces of the broken
pair do not get matched up with other files.  And in this
particular case, since you are limiting the search space to a
single file, there is no other files to match, so the broken
pair should survive the rename detection match-up, and they
should be shown as a normal diff without dissimilarity index at
all.

The funny thing is, the broken pair are matched up with
themselves, with similarity index of 57% (they originally are
from the same filepair, so that is natural).  So in this case,
rename code _should_ take notice.  I'll work on a fix.

-- >8 --
diff --git a/diff.c b/diff.c
index ce98a90..e887410 100644
--- a/diff.c
+++ b/diff.c
@@ -145,8 +145,9 @@ static void emit_rewrite_diff(const char
 			      struct diff_filespec *one, 
 			      struct diff_filespec *two)
 {
-	/* Use temp[i].name as input, name_a and name_b as labels */
 	int lc_a, lc_b;
+	diff_populate_filespec(one, 0);
+	diff_populate_filespec(two, 0);
 	lc_a = count_lines(one->data, one->size);
 	lc_b = count_lines(two->data, two->size);
 	printf("--- %s\n+++ %s\n@@ -", name_a, name_b);

-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]