Skip to content

Commit 1c370ea

Browse files
moygitster
authored andcommitted
Show usage string for 'git log -h', 'git show -h' and 'git diff -h'
Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4d590f0 commit 1c370ea

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

builtin-diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
218218
revs->max_count = 3;
219219
else if (!strcmp(argv[1], "-q"))
220220
options |= DIFF_SILENT_ON_REMOVED;
221+
else if (!strcmp(argv[1], "-h"))
222+
usage(builtin_diff_usage);
221223
else
222224
return error("invalid option: %s", argv[1]);
223225
argv++; argc--;

builtin-log.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ static int default_show_root = 1;
2727
static const char *fmt_patch_subject_prefix = "PATCH";
2828
static const char *fmt_pretty;
2929

30+
static const char * const builtin_log_usage =
31+
"git log [<options>] [<since>..<until>] [[--] <path>...]\n"
32+
" or: git show [options] <object>...";
33+
3034
static void cmd_log_init(int argc, const char **argv, const char *prefix,
3135
struct rev_info *rev)
3236
{
@@ -61,6 +65,8 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
6165
rev->show_decorations = 1;
6266
} else if (!strcmp(arg, "--source")) {
6367
rev->show_source = 1;
68+
} else if (!strcmp(arg, "-h")) {
69+
usage(builtin_log_usage);
6470
} else
6571
die("unrecognized argument: %s", arg);
6672
}

0 commit comments

Comments
 (0)