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

Commit 6562928

Browse files
johnkeepingjrn
authored andcommitted
merge-recursive: fix parsing of "diff-algorithm" option
The "diff-algorithm" option to the recursive merge strategy takes the name of the algorithm as an option, but it uses strcmp on the option string to check if it starts with "diff-algorithm=", meaning that this options cannot actually be used. Fix this by switching to prefixcmp. At the same time, clarify the following line by using strlen instead of a hard-coded length, which also makes it consistent with nearby code. Reported-by: Luke Noel-Storr <[email protected]> Signed-off-by: John Keeping <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]>
1 parent 0895c6d commit 6562928

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

merge-recursive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,8 @@ int parse_merge_opt(struct merge_options *o, const char *s)
20682068
o->xdl_opts = DIFF_WITH_ALG(o, PATIENCE_DIFF);
20692069
else if (!strcmp(s, "histogram"))
20702070
o->xdl_opts = DIFF_WITH_ALG(o, HISTOGRAM_DIFF);
2071-
else if (!strcmp(s, "diff-algorithm=")) {
2072-
long value = parse_algorithm_value(s+15);
2071+
else if (!prefixcmp(s, "diff-algorithm=")) {
2072+
long value = parse_algorithm_value(s + strlen("diff-algorithm="));
20732073
if (value < 0)
20742074
return -1;
20752075
/* clear out previous settings */

0 commit comments

Comments
 (0)