]> git.neil.brown.name Git - git.git/commitdiff
revision.c: stricter parsing of '--no-{min,max}-parents'
authorSZEDER Gábor <szeder.dev@gmail.com>
Fri, 9 Jun 2017 18:17:30 +0000 (20:17 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 12 Jun 2017 20:39:43 +0000 (13:39 -0700)
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 <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
revision.c

index b37dbec378f3ae1a33d00d591c1042c609e45fa4..8a40cc7b34eaed3a53f6d9c8ce56a4aace45fdd2 100644 (file)
@@ -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;