summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-21 20:18:23 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-21 20:21:24 (GMT)
commit9f70b806920e3ea158d7e189a1ec668445c13359 (patch)
tree0de8fc57e0e221f5588f895eb161faee5acc9e7d
parent88b5a74883f146eac4b15b30e74bbdeb5ab5a63a (diff)
downloadgit-9f70b806920e3ea158d7e189a1ec668445c13359.zip
git-9f70b806920e3ea158d7e189a1ec668445c13359.tar.gz
git-9f70b806920e3ea158d7e189a1ec668445c13359.tar.bz2
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>
-rw-r--r--diff.c4
-rw-r--r--diffcore-rename.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 0391e8c..0f839c1 100644
--- a/diff.c
+++ b/diff.c
@@ -853,6 +853,10 @@ static int parse_num(const char **cp_p)
}
*cp_p = cp;
+ /* special case: -M100 would mean 1.0 not 0.1 */
+ if (num == 100 && scale == 1000)
+ return MAX_SCORE;
+
/* user says num divided by scale and we say internally that
* is MAX_SCORE * num / scale.
*/
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 6a9d95d..dba965c 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -307,6 +307,9 @@ void diffcore_rename(struct diff_options *options)
if (rename_count == rename_dst_nr)
goto cleanup;
+ if (minimum_score == MAX_SCORE)
+ goto cleanup;
+
num_create = (rename_dst_nr - rename_count);
num_src = rename_src_nr;
mx = xmalloc(sizeof(*mx) * num_create * num_src);