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>
SZEDER Gábor committed
Jun 9, 2017 at 20:17 UTC
9ada7aee198c3644604eac1ff7cc50284b48d85f
1 file changed
+2
-2
revision.c
+2
-2
@@ -1777,11 +1777,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
1777
revs->max_parents = 1;
1778
} else if (starts_with(arg, "--min-parents=")) {
1779
revs->min_parents = atoi(arg+14);
1780
- } else if (starts_with(arg, "--no-min-parents")) {
1780
+ } else if (!strcmp(arg, "--no-min-parents")) {
1781
revs->min_parents = 0;
1782
} else if (starts_with(arg, "--max-parents=")) {
1783
revs->max_parents = atoi(arg+14);
1784
- } else if (starts_with(arg, "--no-max-parents")) {
1784
+ } else if (!strcmp(arg, "--no-max-parents")) {
1785
revs->max_parents = -1;
1786
} else if (!strcmp(arg, "--boundary")) {
1787
revs->boundary = 1;