summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-02-08 15:29:02 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-08 15:29:02 -0800
commitecf6778e8ef243dd9b34eef57212c44baffb13a2 (patch)
treea48853df0c40a6478a56e1610e035f81968519ae /builtin/apply.c
parentd03d820a8c4b1eada9528e95baf9f39607034b97 (diff)
parentafcb6ac83d8854f8cc271bb4e933836c9d4f1d3b (diff)
downloadgit-ecf6778e8ef243dd9b34eef57212c44baffb13a2.tar.gz
Merge branch 'jk/apply-similaritly-parsing'
Make sure the similarity value shown in the "apply --summary" output is sensible, even when the input had a bogus value. * jk/apply-similaritly-parsing: builtin/apply: tighten (dis)similarity index parsing
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 9706ca73ab..080ce2ea3e 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;
}