Skip to content

Commit

Permalink
Show usage string for 'git log -h', 'git show -h' and 'git diff -h'
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Matthieu Moy authored and Junio C Hamano committed Aug 7, 2009
1 parent 4d590f0 commit 1c370ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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--;
Expand Down
6 changes: 6 additions & 0 deletions builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 [<options>] [<since>..<until>] [[--] <path>...]\n"
" or: git show [options] <object>...";

static void cmd_log_init(int argc, const char **argv, const char *prefix,
struct rev_info *rev)
{
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 1c370ea

Please sign in to comment.