Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: Re: git-diff-tree -B broken
Date: Sat, 08 Apr 2006 19:51:12 -0700	[thread overview]
Message-ID: <7vwtdzcvhb.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: 20060409004605.GU27689@pasky.or.cz

Petr Baudis <pasky@ucw.cz> 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);

  reply	other threads:[~2006-04-09  2:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-09  0:46 git-diff-tree -B broken Petr Baudis
2006-04-09  2:51 ` Junio C Hamano [this message]
2006-04-09  3:30   ` [PATCH] diffcore-rename: fix merging back a broken pair Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vwtdzcvhb.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox