Skip to content

Commit 9ada7ae

Browse files
szedergitster
authored andcommitted
revision.c: stricter parsing of '--no-{min,max}-parents'
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>
1 parent e35b6ac commit 9ada7ae

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

revision.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,11 +1777,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
17771777
revs->max_parents = 1;
17781778
} else if (starts_with(arg, "--min-parents=")) {
17791779
revs->min_parents = atoi(arg+14);
1780-
} else if (starts_with(arg, "--no-min-parents")) {
1780+
} else if (!strcmp(arg, "--no-min-parents")) {
17811781
revs->min_parents = 0;
17821782
} else if (starts_with(arg, "--max-parents=")) {
17831783
revs->max_parents = atoi(arg+14);
1784-
} else if (starts_with(arg, "--no-max-parents")) {
1784+
} else if (!strcmp(arg, "--no-max-parents")) {
17851785
revs->max_parents = -1;
17861786
} else if (!strcmp(arg, "--boundary")) {
17871787
revs->boundary = 1;

0 commit comments

Comments
 (0)