{"thread":{"id":"45096","subject":"[PATCH] help: show help for aliases","startedAt":"2017-02-10T01:33:21Z","lastAt":"2017-02-10T01:47:03Z","messageCount":2,"participants":["Tom Kunze","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"311243","messageId":"137f35a4-ec2e-b8aa-c6a5-b17688eca61a@tomabrafix.de","threadId":"45096","inReplyTo":null,"subject":"[PATCH] help: show help for aliases","fromName":"Tom Kunze","fromEmail":"mail@tom-kunze.de","sentAt":"2017-02-10T00:17:53Z","receivedAt":"2017-02-10T01:33:21Z","isPatch":true,"sender":{"key":"mail@tom-kunze.de","avatar":null},"body":"If an alias is a single git command show the man page of the\naliased git command with --help.\n\nSigned-off-by: Tom Kunze <mail@tom-kunze.de>\n---\nHi,\n\nI noticed that when I pass --help to an alias which is only a git\ncommand it tells me a information about the alias. But it would be\nnice if it instead opens the corresponding man page of the command.\n\nThere is a memory leak but in my opinion it can be ignored because\nthe process will be replaced anyway.\n\nRegards,\nTom Kunze\n\nPS: Please add me to cc as I am not subscribed.\n\n builtin/help.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/builtin/help.c b/builtin/help.c\nindex 49f7a07..655ed49 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -437,6 +437,10 @@ static const char *check_git_cmd(const char* cmd)\n\n \talias = alias_lookup(cmd);\n \tif (alias) {\n+\t\tif (alias[0] != '!') {\n+\t\t\tstrtok(alias, \" \\t\\n\");\n+\t\t\treturn alias;\n+\t\t}\n \t\tprintf_ln(_(\"`git %s' is aliased to `%s'\"), cmd, alias);\n \t\tfree(alias);\n \t\texit(0);\n-- \n2.1.4\n"},{"id":"311244","messageId":"xmqq7f4yn7fz.fsf@gitster.mtv.corp.google.com","threadId":"45096","inReplyTo":"137f35a4-ec2e-b8aa-c6a5-b17688eca61a@tomabrafix.de","subject":"Re: [PATCH] help: show help for aliases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-02-10T01:46:56Z","receivedAt":"2017-02-10T01:47:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Tom Kunze <mail@tom-kunze.de> writes:\n\n> If an alias is a single git command show the man page of the\n> aliased git command with --help.\n>\n> Signed-off-by: Tom Kunze <mail@tom-kunze.de>\n> ...\n> diff --git a/builtin/help.c b/builtin/help.c\n> index 49f7a07..655ed49 100644\n> --- a/builtin/help.c\n> +++ b/builtin/help.c\n> @@ -437,6 +437,10 @@ static const char *check_git_cmd(const char* cmd)\n>\n>  \talias = alias_lookup(cmd);\n>  \tif (alias) {\n> +\t\tif (alias[0] != '!') {\n> +\t\t\tstrtok(alias, \" \\t\\n\");\n> +\t\t\treturn alias;\n> +\t\t}\n\nWhile I understand where you come from, I am moderately negative,\nespecially with that strtok() to ignore options.\n\nFor a truly simple alias, e.g.\n\n    $ git co --help\n    `git co' is aliased to `checkout'\n\nI do not think I would mind the updated behaviour given by this\npatch that much.\n\nBut most of the time, when I do \"help\" on an alias, I am primarily\ninterested in what default customization I am using over the base\ncommand, i.e.\n\n    $ git lgf --help\n    `git lgf' is aliased to `log --oneline --boundary --first-parent'\n\nis my way to remind me that I am using these three options to \"git\nlog\" in the alias I very often use (and forgot what they were).\n\nJumping directly to the \"git log\" manual page is the last thing I\nwant \"help\" to do.\n"}]}