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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Nov 9, 2009 at 09:04 UTC
fef34270f209eb5d2cde01b8175b24d96d1cff21
1 file changed
+3
builtin-log.c
+3
@@ -1237,6 +1237,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
1237
argv++;
1238
}
1239
1240
+ if (argc > 1 && !strcmp(argv[1], "-h"))
1241
+ usage(cherry_usage);
1242
+
1243
switch (argc) {
1244
case 4:
1245
limit = argv[3];