提交 fef34270 编写于 作者: J Jonathan Nieder 提交者: Junio C Hamano

Show usage string for 'git cherry -h'

Treat an "-h" option as a request for help, rather than an
"Unknown commit -h" error.

"cherry -h" could be asking to compare histories that leads to
our HEAD and a commit that can be named as "-h".  Strictly
speaking, that may be a valid refname, but the user would have to
say something like "tags/-h" to name such a pathological ref
already, so it is not such a big deal.

The "-h" option keeps its meaning even if preceded by other
options or followed by other arguments.  This keeps the
command-line syntax closer to what parse_options would give and
supports shell aliases like 'alias cherry="git cherry -v"' a
little better.
Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 9c855c31
......@@ -1237,6 +1237,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
argv++;
}
if (argc > 1 && !strcmp(argv[1], "-h"))
usage(cherry_usage);
switch (argc) {
case 4:
limit = argv[3];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册