Re: git log is a bit antisocial
- From
Junio C Hamano <junkio@cox.net>
- Date
- Apr 14, 2006, 21:28 UTC
- Message-ID
- <7vhd4vq23h.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <Pine.LNX.4.64.0604141719290.2215@localhost.localdomain>
Nicolas Pitre <nico@cam.org> writes:
Show 14 quoted lines
> On Fri, 14 Apr 2006, Junio C Hamano wrote: > >> Nicolas Pitre <nico@cam.org> writes: >> >> > $ git log -h >> > fatal: unrecognized argument: -h >> > $ git log --help >> > fatal: unrecognized argument: --help >> > >> > Maybe the usage string could be printed in those cases? >> >> Perhaps. Alternatively, "git help log", perhaps. > > What about git-log then?
What about it?
Asking for help on log could be spelled as "git log --help" with a patch like the attached, but I am not sure that is worth it...
-- >8 --
diff --git a/git.c b/git.c index 78ed403..7fdacdd 100644 --- a/git.c +++ b/git.c @@ -497,6 +497,16 @@ int main(int argc, const char **argv, ch } argv[0] = cmd; + /* It could be git blah --help or git boo -h, but be + * careful; most commands have their own '-h' and '--help'. + */ + if (argc == 2 && + (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) { + argv[0] = "help"; + argv[1] = cmd; + exit(cmd_help(1, argv, envp)); + } + /* * We search for git commands in the following order: * - git_exec_path()