diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2009-11-09 09:05:01 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-10 12:00:21 -0800 |
commit | 99caeed05d3e89176d352104a2b70a77aa7e5d81 (patch) | |
tree | f65515f8b4302877d661176266cd6bf9a75e5a53 /builtin-log.c | |
parent | 548d3464dc446db58a8fc8f7a8cc6cfb2d683faa (diff) | |
download | git-99caeed05d3e89176d352104a2b70a77aa7e5d81.tar.gz |
Let 'git <command> -h' show usage without a git dir
There is no need for "git <command> -h" to depend on being inside
a repository.
Reported by Gerfried Fuchs through http://bugs.debian.org/462557
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.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-log.c b/builtin-log.c index 524850735a..a0fa30c408 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -50,6 +50,12 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix, if (default_date_mode) rev->date_mode = parse_date_format(default_date_mode); + /* + * Check for -h before setup_revisions(), or "git log -h" will + * fail when run without a git directory. + */ + if (argc == 2 && !strcmp(argv[1], "-h")) + usage(builtin_log_usage); argc = setup_revisions(argc, argv, rev, "HEAD"); if (rev->diffopt.pickaxe || rev->diffopt.filter) |