Merge branch 'jk/apply-similaritly-parsing' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Feb 2013 16:03:44 +0000 (08:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Feb 2013 16:03:44 +0000 (08:03 -0800)
* jk/apply-similaritly-parsing:
builtin/apply: tighten (dis)similarity index parsing

builtin/apply.c
index 9706ca73ab0bc2ee4c3cf7ce7ab39591830a1fab..080ce2ea3e4d6290e5db5567c0bdd217725a36c4 100644 (file)
@@ -1041,15 +1041,17 @@ static int gitdiff_renamedst(const char *line, struct patch *patch)
 
 static int gitdiff_similarity(const char *line, struct patch *patch)
 {
-       if ((patch->score = strtoul(line, NULL, 10)) == ULONG_MAX)
-               patch->score = 0;
+       unsigned long val = strtoul(line, NULL, 10);
+       if (val <= 100)
+               patch->score = val;
        return 0;
 }
 
 static int gitdiff_dissimilarity(const char *line, struct patch *patch)
 {
-       if ((patch->score = strtoul(line, NULL, 10)) == ULONG_MAX)
-               patch->score = 0;
+       unsigned long val = strtoul(line, NULL, 10);
+       if (val <= 100)
+               patch->score = val;
        return 0;
 }