Thread (1 message) 1 message, 1 author, 2017-02-10

Re: [PATCH] help: show help for aliases

From: Junio C Hamano <hidden>
Date: 2017-02-10 01:47:03

Tom Kunze [off-list ref] writes:
quoted hunk
If an alias is a single git command show the man page of the
aliased git command with --help.

Signed-off-by: Tom Kunze <redacted>
...
diff --git a/builtin/help.c b/builtin/help.c
index 49f7a07..655ed49 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -437,6 +437,10 @@ static const char *check_git_cmd(const char* cmd)

 	alias = alias_lookup(cmd);
 	if (alias) {
+		if (alias[0] != '!') {
+			strtok(alias, " \t\n");
+			return alias;
+		}
While I understand where you come from, I am moderately negative,
especially with that strtok() to ignore options.

For a truly simple alias, e.g.

    $ git co --help
    `git co' is aliased to `checkout'

I do not think I would mind the updated behaviour given by this
patch that much.

But most of the time, when I do "help" on an alias, I am primarily
interested in what default customization I am using over the base
command, i.e.

    $ git lgf --help
    `git lgf' is aliased to `log --oneline --boundary --first-parent'

is my way to remind me that I am using these three options to "git
log" in the alias I very often use (and forgot what they were).

Jumping directly to the "git log" manual page is the last thing I
want "help" to do.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help