Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 66d12f9

Browse files
committed
Merge branch 'jk/apply-similaritly-parsing' into maint
* jk/apply-similaritly-parsing: builtin/apply: tighten (dis)similarity index parsing
2 parents 7be0931 + afcb6ac commit 66d12f9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

builtin/apply.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,15 +1041,17 @@ static int gitdiff_renamedst(const char *line, struct patch *patch)
10411041

10421042
static int gitdiff_similarity(const char *line, struct patch *patch)
10431043
{
1044-
if ((patch->score = strtoul(line, NULL, 10)) == ULONG_MAX)
1045-
patch->score = 0;
1044+
unsigned long val = strtoul(line, NULL, 10);
1045+
if (val <= 100)
1046+
patch->score = val;
10461047
return 0;
10471048
}
10481049

10491050
static int gitdiff_dissimilarity(const char *line, struct patch *patch)
10501051
{
1051-
if ((patch->score = strtoul(line, NULL, 10)) == ULONG_MAX)
1052-
patch->score = 0;
1052+
unsigned long val = strtoul(line, NULL, 10);
1053+
if (val <= 100)
1054+
patch->score = val;
10531055
return 0;
10541056
}
10551057

0 commit comments

Comments
 (0)