Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tom Kunze <mail@tom-kunze.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] help: show help for aliases
Date: Thu, 09 Feb 2017 17:46:56 -0800	[thread overview]
Message-ID: <xmqq7f4yn7fz.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <137f35a4-ec2e-b8aa-c6a5-b17688eca61a@tomabrafix.de> (Tom Kunze's message of "Fri, 10 Feb 2017 01:17:53 +0100")

Tom Kunze <mail@tom-kunze.de> writes:

> If an alias is a single git command show the man page of the
> aliased git command with --help.
>
> Signed-off-by: Tom Kunze <mail@tom-kunze.de>
> ...
> 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.

      reply	other threads:[~2017-02-10  1:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-10  0:17 [PATCH] help: show help for aliases Tom Kunze
2017-02-10  1:46 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7f4yn7fz.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mail@tom-kunze.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox