From 9ada7aee198c3644604eac1ff7cc50284b48d85f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Fri, 9 Jun 2017 20:17:30 +0200 Subject: revision.c: stricter parsing of '--no-{min,max}-parents' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These two options are parsed using starts_with(), allowing things like 'git log --no-min-parents-foobarbaz' to succeed. Use strcmp() instead. Signed-off-by: SZEDER Gábor Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- revision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/revision.c b/revision.c index b37dbec378..8a40cc7b34 100644 --- a/revision.c +++ b/revision.c @@ -1777,11 +1777,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg revs->max_parents = 1; } else if (starts_with(arg, "--min-parents=")) { revs->min_parents = atoi(arg+14); - } else if (starts_with(arg, "--no-min-parents")) { + } else if (!strcmp(arg, "--no-min-parents")) { revs->min_parents = 0; } else if (starts_with(arg, "--max-parents=")) { revs->max_parents = atoi(arg+14); - } else if (starts_with(arg, "--no-max-parents")) { + } else if (!strcmp(arg, "--no-max-parents")) { revs->max_parents = -1; } else if (!strcmp(arg, "--boundary")) { revs->boundary = 1; -- cgit v1.2.3