From: John Keeping <john@keeping.me.uk>
To: git@vger.kernel.org
Cc: Luke Noel-Storr <luke.noel-storr@integrate.co.uk>,
Michal Privoznik <mprivozn@redhat.com>,
John Keeping <john@keeping.me.uk>
Subject: [PATCH] merge-recursive: fix parsing of "diff-algorithm" option
Date: Thu, 26 Sep 2013 21:02:48 +0100 [thread overview]
Message-ID: <689bf88b6f1d33e123cc786042cc6dba23464351.1380225743.git.john@keeping.me.uk> (raw)
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>
---
merge-recursive.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 40eb840..dbb7104 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -2069,8 +2069,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 */
--
1.8.4.566.g73d370b
next reply other threads:[~2013-09-26 20:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-26 20:02 John Keeping [this message]
2013-09-26 20:47 ` [PATCH] merge-recursive: fix parsing of "diff-algorithm" option Jonathan Nieder
2013-09-26 21:13 ` John Keeping
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=689bf88b6f1d33e123cc786042cc6dba23464351.1380225743.git.john@keeping.me.uk \
--to=john@keeping.me.uk \
--cc=git@vger.kernel.org \
--cc=luke.noel-storr@integrate.co.uk \
--cc=mprivozn@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).