Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2009-11-09 18:04:43 +0300
committerJunio C Hamano <gitster@pobox.com>2009-11-10 04:08:44 +0300
commitfef34270f209eb5d2cde01b8175b24d96d1cff21 (patch)
tree2ecd9598a8b49c3ca885608331295d61d3ddf2f8 /builtin-log.c
parent9c855c31786b9e879ef4cd3b8b5aa97bc4bcf8ec (diff)
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>
Diffstat (limited to 'builtin-log.c')
-rw-r--r--builtin-log.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c
index 207a36178b..524850735a 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];