From: Jonathan Nieder Date: Mon, 9 Nov 2009 15:04:43 +0000 (-0600) Subject: Show usage string for 'git cherry -h' X-Git-Tag: v1.6.6-rc0~34^2~20 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=fef34270f209eb5d2cde01b8175b24d96d1cff21;p=git.git 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: Jonathan Nieder Signed-off-by: Junio C Hamano --- diff --git a/builtin-log.c b/builtin-log.c index 207a36178..524850735 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -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];