Code

[PATCH] Fix math thinko in similarity estimator.
authorJunio C Hamano <junkio@cox.net>
Fri, 27 May 2005 22:49:54 +0000 (15:49 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sun, 29 May 2005 18:17:43 +0000 (11:17 -0700)
The math to reject delta that is too big was confused.

Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diffcore-rename.c

index 07782f4b7bc89ad24c2fdb669ccf0ede7ddaba07..81e4d9df3dcb0ba8646fa8f902f6ac918d04bdb7 100644 (file)
@@ -163,7 +163,7 @@ static int estimate_similarity(struct diff_filespec *src,
        /* A delta that has a lot of literal additions would have
         * big delta_size no matter what else it does.
         */
-       if (minimum_score < MAX_SCORE * delta_size / base_size)
+       if (base_size * (MAX_SCORE-minimum_score) < delta_size * MAX_SCORE)
                return 0;
 
        /* Estimate the edit size by interpreting delta. */