Thread (3 messages) flat view 3 messages, 1 author, 2016-06-15
DORMANTno replies

[PATCH 3/3] diffcore-rename: improve estimate_similarity() heuristics

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: 2016-06-15 22:50:36
Subsystem: the rest · Maintainer: Linus Torvalds

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Fri, 18 Feb 2011 20:12:06 -0800

The logic to quickly dismiss potential rename pairs was broken.  It
would too eagerly dismiss possible renames when all of the difference
was due to pure new data (or deleted data).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

This is the trivial one-liner, now with a changelog and sign-off. It 
changes the percentage of the size difference (delta_size) to be compared 
against the larger file size rather than the smaller file size.

 diffcore-rename.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/diffcore-rename.c b/diffcore-rename.c
index b9b039d..0cd4c13 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -170,7 +170,7 @@ static int estimate_similarity(struct diff_filespec *src,
 	 * and the final score computation below would not have a
 	 * divide-by-zero issue.
 	 */
-	if (base_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
+	if (max_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
 		return 0;
 
 	if (!src->cnt_data && diff_populate_filespec(src, 0))
-- 
1.7.4.1.51.g2bf8a
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help