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
This commit is contained in:
commit
ecf6778e8e
@ -1041,15 +1041,17 @@ static int gitdiff_renamedst(const char *line, struct patch *patch)
|
|||||||
|
|
||||||
static int gitdiff_similarity(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)
|
unsigned long val = strtoul(line, NULL, 10);
|
||||||
patch->score = 0;
|
if (val <= 100)
|
||||||
|
patch->score = val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int gitdiff_dissimilarity(const char *line, struct patch *patch)
|
static int gitdiff_dissimilarity(const char *line, struct patch *patch)
|
||||||
{
|
{
|
||||||
if ((patch->score = strtoul(line, NULL, 10)) == ULONG_MAX)
|
unsigned long val = strtoul(line, NULL, 10);
|
||||||
patch->score = 0;
|
if (val <= 100)
|
||||||
|
patch->score = val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user