summaryrefslogtreecommitdiff
path: root/merge-recursive.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-09-26 20:02:48 (GMT)
committerJonathan Nieder <jrnieder@gmail.com>2013-09-26 20:52:16 (GMT)
commit6562928ae9ea46a3f2a7bd5a3dd500a7c149cc64 (patch)
treee608b1930401d15dfd4c3d041c78a70c1e639453 /merge-recursive.c
parent0895c6d4c09045a3faeb7b652a844fc81c774631 (diff)
downloadgit-6562928ae9ea46a3f2a7bd5a3dd500a7c149cc64.zip
git-6562928ae9ea46a3f2a7bd5a3dd500a7c149cc64.tar.gz
git-6562928ae9ea46a3f2a7bd5a3dd500a7c149cc64.tar.bz2
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 <luke.noel-storr@integrate.co.uk> Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Diffstat (limited to 'merge-recursive.c')
-rw-r--r--merge-recursive.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/merge-recursive.c b/merge-recursive.c
index ea9dbd3..1cd511b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2068,8 +2068,8 @@ int parse_merge_opt(struct merge_options *o, const char *s)
o->xdl_opts = DIFF_WITH_ALG(o, PATIENCE_DIFF);
else if (!strcmp(s, "histogram"))
o->xdl_opts = DIFF_WITH_ALG(o, HISTOGRAM_DIFF);
- else if (!strcmp(s, "diff-algorithm=")) {
- long value = parse_algorithm_value(s+15);
+ else if (!prefixcmp(s, "diff-algorithm=")) {
+ long value = parse_algorithm_value(s + strlen("diff-algorithm="));
if (value < 0)
return -1;
/* clear out previous settings */