From: Matthieu Moy Date: Thu, 6 Aug 2009 10:47:21 +0000 (+0200) Subject: Show usage string for 'git log -h', 'git show -h' and 'git diff -h' X-Git-Tag: v1.6.5-rc0~99 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1c370ea4e519f8facaf321b633f79eb68a14a0db;p=git.git Show usage string for 'git log -h', 'git show -h' and 'git diff -h' Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- diff --git a/builtin-diff.c b/builtin-diff.c index 2e51f408f..ffcdd055c 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -218,6 +218,8 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv revs->max_count = 3; else if (!strcmp(argv[1], "-q")) options |= DIFF_SILENT_ON_REMOVED; + else if (!strcmp(argv[1], "-h")) + usage(builtin_diff_usage); else return error("invalid option: %s", argv[1]); argv++; argc--; diff --git a/builtin-log.c b/builtin-log.c index 30358166e..3817bf118 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -27,6 +27,10 @@ static int default_show_root = 1; static const char *fmt_patch_subject_prefix = "PATCH"; static const char *fmt_pretty; +static const char * const builtin_log_usage = + "git log [] [..] [[--] ...]\n" + " or: git show [options] ..."; + static void cmd_log_init(int argc, const char **argv, const char *prefix, struct rev_info *rev) { @@ -61,6 +65,8 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, rev->show_decorations = 1; } else if (!strcmp(arg, "--source")) { rev->show_source = 1; + } else if (!strcmp(arg, "-h")) { + usage(builtin_log_usage); } else die("unrecognized argument: %s", arg); }