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>
This commit is contained in:

committed by
Junio C Hamano

parent
548d3464dc
commit
99caeed05d
@ -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)
|
||||
|
Reference in New Issue
Block a user