git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: 김남형 <namhyung.kim@lge.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 1/3] help: Fix help message for aliases
Date: Thu, 15 Mar 2012 14:15:14 +0900	[thread overview]
Message-ID: <4F617AE2.9050700@lge.com> (raw)
In-Reply-To: <20120315041734.GD4149@sigill.intra.peff.net>

Hi,

2012-03-15 1:17 PM, Jeff King wrote:
> On Thu, Mar 15, 2012 at 11:52:47AM +0900, Namhyung Kim wrote:
>
>> The current "`git br' is aliased to `branch'" looks a bit
>> strange. Prepend 'git' to aliased output too so that the
>> end result will be looked like this:
>>
>>   $ git help br
>>   `git br' is aliased to `git branch'
>
> I think that is a sensible improvement, but...
>
>> diff --git a/builtin/help.c b/builtin/help.c
>> index 61ff798..f85c870 100644
>> --- a/builtin/help.c
>> +++ b/builtin/help.c
>> @@ -445,7 +445,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
>>
>>   	alias = alias_lookup(argv[0]);
>>   	if (alias && !is_git_command(argv[0])) {
>> -		printf("`git %s' is aliased to `%s'\n", argv[0], alias);
>> +		printf("`git %s' is aliased to `git %s'\n", argv[0], alias);
>>   		return 0;
>
> What output does this produce for:
>
>    $ git config alias.foo '!f() { git log $1@{u}..$1; }; f'
>    $ git help foo
>
> ?
>

Oh, I didn't think of such a complicated case. Hmm, how about checking whether 
the first word is a git command or not:

		printf("`git %s' is aliased to `%s%s'\n", argv[0],
			is_git_command(first_word) ? "git " : "", alias);

Thanks,
Namhyung

  reply	other threads:[~2012-03-15  5:15 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   ` 김남형 [this message]
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

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=4F617AE2.9050700@lge.com \
    --to=namhyung.kim@lge.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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).