提交 9ada7aee 编写于 作者: S SZEDER Gábor 提交者: Junio C Hamano

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: NSZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e35b6ac5
...@@ -1777,11 +1777,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg ...@@ -1777,11 +1777,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
revs->max_parents = 1; revs->max_parents = 1;
} else if (starts_with(arg, "--min-parents=")) { } else if (starts_with(arg, "--min-parents=")) {
revs->min_parents = atoi(arg+14); 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; revs->min_parents = 0;
} else if (starts_with(arg, "--max-parents=")) { } else if (starts_with(arg, "--max-parents=")) {
revs->max_parents = atoi(arg+14); 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; revs->max_parents = -1;
} else if (!strcmp(arg, "--boundary")) { } else if (!strcmp(arg, "--boundary")) {
revs->boundary = 1; revs->boundary = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册