aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-25 08:03:44 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-25 08:03:44 -0800
commit66d12f97d0712b26f034fbc1ef78eefdadef2bd6 (patch)
tree30c93b2c1aace1375bfcfd68ae3e9ecf478e38ea
parent7be093133c629f648eba506bbcbfc4b137b0728d (diff)
parentafcb6ac83d8854f8cc271bb4e933836c9d4f1d3b (diff)
downloadgit-66d12f97d0712b26f034fbc1ef78eefdadef2bd6.tar.gz
git-66d12f97d0712b26f034fbc1ef78eefdadef2bd6.tar.xz
Merge branch 'jk/apply-similaritly-parsing' into maint
* jk/apply-similaritly-parsing: builtin/apply: tighten (dis)similarity index parsing
-rw-r--r--builtin/apply.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 9706ca73a..080ce2ea3 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -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;
}