rename detection with -M100 means "exact renames only".
When the user is interested in pure renames, there is no point doing the similarity scores. This changes the score argument parsing to special case -M100 (otherwise, it is a precision scaled value 0 <= v < 1 and would mean 0.1, not 1.0 --- if you do mean 0.1, you can say -M1), and optimizes the diffcore_rename transformation to only look at pure renames in that case. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Nov 21, 2005 at 12:18 UTC
9f70b806920e3ea158d7e189a1ec668445c13359
2 files changed
+7
diff.c
+4
@@ -853,6 +853,10 @@ static int parse_num(const char **cp_p)
853
}
854
*cp_p = cp;
855
856
+ /* special case: -M100 would mean 1.0 not 0.1 */
857
+ if (num == 100 && scale == 1000)
858
+ return MAX_SCORE;
859
+
860
/* user says num divided by scale and we say internally that
861
* is MAX_SCORE * num / scale.
862
*/
diffcore-rename.c
+3
@@ -307,6 +307,9 @@ void diffcore_rename(struct diff_options *options)
307
if (rename_count == rename_dst_nr)
308
goto cleanup;
309
310
+ if (minimum_score == MAX_SCORE)
311
+ goto cleanup;
312
+
313
num_create = (rename_dst_nr - rename_count);
314
num_src = rename_src_nr;
315
mx = xmalloc(sizeof(*mx) * num_create * num_src);