git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: 김남형 <namhyung.kim@lge.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/3] help: Fix help message for aliases
Date: Wed, 14 Mar 2012 23:18:22 -0700	[thread overview]
Message-ID: <7v399amlox.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <4F6182C1.9080600@lge.com> ("김남형"'s message of "Thu, 15 Mar 2012 14:48:49 +0900")

김남형 <namhyung.kim@lge.com> writes:

> 2012-03-15 2:23 PM, Junio C Hamano wrote:
>> Namhyung Kim <namhyung.kim@lge.com> writes:
>>
>>> -		printf("`git %s' is aliased to `%s'\n", argv[0], alias);
>>> +		printf("`git %s' is aliased to `git %s'\n", argv[0], alias);
>>
>> NAK.
>>
>> What would the above change will do to one of my favorite alias?
>>
>> $ git help who
>> `git who' is aliased to `!sh -c 'git log -1 --format="%an<%ae>" --author="$1"' -'
>>
>> Wouldn't removing "git " from the first phrase be a better solution?
>
> Right. But as I replied to Jeff King, it can be improved to check
> whether the aliased output is such a complicated commands or not. Now
> I see that we can examine if the first letter is '!'.

Trimming the four bytes from the beginning would be an improvement by
itself---it makes the output shorter without losing information.

And for your "[alias] br = branch", you will see:

	`br` is aliased to `branch`

which after all is exactly what the user wrote in the configuration.

There is even a worse problem with your "I can look at '!' at the
beginning".  By tweaking the part that is the answer to what the user
asked, depending on the value the user configured, you would not be able
to tell from this output:

	`git br` is aliased to `git branch`

which one the user really has between these two, no?

	[alias] br = branch
        [alias] br = !git branch

In short, I do not think there is any merit trying to be clever and cute
when answering "git help <alias>".  The cleverness will actively hurt by
obscuring the details of the answer you are giving in response to user's
question.

Exactly the same "don't obscure by trying to be clever and cute" comment
applies to the --follow-alias patch. There is nothing wrong in the series
of revelation:

 1. The user types 'git help br',
 2. The user then realizes it is aliased to 'branch' (this could even
    be 'branch --list'), then
 3. The user asks 'git help branch' (and perhaps goes to read on --list)

      reply	other threads:[~2012-03-15  6:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-15  2:52 [PATCH 1/3] help: Fix help message for aliases Namhyung Kim
2012-03-15  2:52 ` [PATCH 2/3] help: Add '--follow-alias' option Namhyung Kim
2012-03-15  6:00   ` Junio C Hamano
2012-03-15  6:15     ` 김남형
2012-03-15  6:23       ` Junio C Hamano
2012-03-15  6:46         ` Namhyung Kim
2012-03-15  7:09           ` Junio C Hamano
2012-03-15  2:52 ` [PATCH 3/3] help: Add 'help.follow-alias' config item Namhyung Kim
2012-03-15  6:06   ` Junio C Hamano
2012-03-15  6:29     ` Namhyung Kim
2012-03-15  4:17 ` [PATCH 1/3] help: Fix help message for aliases Jeff King
2012-03-15  5:15   ` 김남형
2012-03-15 13:19     ` Jeff King
2012-03-15  5:23 ` Junio C Hamano
2012-03-15  5:48   ` 김남형
2012-03-15  6:18     ` 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=7v399amlox.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=namhyung.kim@lge.com \
    /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;
as well as URLs for NNTP newsgroup(s).