public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha•warpmail.net>
To: Junio C Hamano <gitster@pobox•com>
Cc: Jakob Pfender <jpfender@elegosoft•com>,
	git@vger•kernel.org, johannes.schindelin@gmx•de,
	lee.marlow@gmail•com, markus.heidelberg@web•de,
	szeder@ira•uka.de, spearce@spearce•org, bebarino@gmail•com,
	ted@tedpavlic•com, tlikonen@iki•fi, trast@student•ethz.ch
Subject: Re: [PATCH] git-completion: Add git help completion for aliases
Date: Tue, 22 Mar 2011 10:23:42 +0100	[thread overview]
Message-ID: <4D886A9E.6050405@drmicha.warpmail.net> (raw)
In-Reply-To: <7vhbawno11.fsf@alter.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 21.03.2011 22:48:
> Jakob Pfender <jpfender@elegosoft•com> writes:
> 
>> Enable bash completion for "git help <alias>", analogous to "git
>> <alias>", which was already implemented.
>>
>> Signed-off-by: Jakob Pfender <jpfender@elegosoft•com>
>> ---
>>  contrib/completion/git-completion.bash |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/contrib/completion/git-completion.bash
>> b/contrib/completion/git-completion.bash
>> index 893b771..f9a74d3 100755
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -1506,7 +1506,7 @@ _git_help ()
>>  		;;
>>  	esac
>>  	__git_compute_all_commands
>> -	__gitcomp "$__git_all_commands
>> +	__gitcomp "$__git_all_commands $(__git_aliases)
>>  		attributes cli core-tutorial cvs-migration
>>  		diffcore gitk glossary hooks ignore modules
>>  		repository-layout tutorial tutorial-2
> 
> This patch may not be _wrong_ per-se, but it it useful in practice?
> 
> I dunno.
> 
> Don't people usually use aliases so that they do not have to type long
> command names that would need completion?

I'd say this would be a perfect argument for "do not suggest aliases for
'git <cmd>'"; independent of that, we could still suggest aliases for
'git help <cmd>' since, presumably, you use commands more often than you
look up help...

But currently, we do it the other way round, and even worse:

git for<TAB>
for-each-ref-do   format-patch

git help for<TAB>
for-each-ref   format-patch

That is, git command completion lists aliases (for-each-ref-do) and
common commands, and git help completion lists no aliases and all commands.

The patch makes it so that the suggestions for git command are a subset
of those for git help command, which is a good thing. (Not completing
aliases for 'git <cmd>' would be good also, on top of that.)

And yes, I use git help <alias> a lot, because I don't like git config
--get alias.<alias>, and our config files tend to grow in ugliness over
time. (We need git config --broomstick or git config --vacuum.)

Michael

      parent reply	other threads:[~2011-03-22  9:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21  9:25 [PATCH] git-completion: Add git help completion for aliases Jakob Pfender
2011-03-21 21:48 ` Junio C Hamano
2011-03-21 22:07   ` Johannes Schindelin
2011-03-22  7:53     ` Junio C Hamano
2011-03-22  8:44       ` Johannes Schindelin
2011-03-22  8:50       ` SZEDER Gábor
2011-03-22  9:16         ` Erik Faye-Lund
2011-03-22  9:18           ` Erik Faye-Lund
2011-03-22 10:09           ` SZEDER Gábor
2011-03-22 10:28             ` Erik Faye-Lund
2011-03-22 16:38               ` Michael J Gruber
2011-03-22 20:25               ` SZEDER Gábor
2011-03-23 10:32                 ` Erik Faye-Lund
2011-03-23 12:11                   ` Jakub Narebski
2011-03-23 12:16                     ` Erik Faye-Lund
2011-03-22 17:25         ` Junio C Hamano
2011-03-22 21:21           ` SZEDER Gábor
2011-03-22  8:23   ` SZEDER Gábor
2011-03-22  9:23   ` Michael J Gruber [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=4D886A9E.6050405@drmicha.warpmail.net \
    --to=git@drmicha$(echo .)warpmail.net \
    --cc=bebarino@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=johannes.schindelin@gmx$(echo .)de \
    --cc=jpfender@elegosoft$(echo .)com \
    --cc=lee.marlow@gmail$(echo .)com \
    --cc=markus.heidelberg@web$(echo .)de \
    --cc=spearce@spearce$(echo .)org \
    --cc=szeder@ira$(echo .)uka.de \
    --cc=ted@tedpavlic$(echo .)com \
    --cc=tlikonen@iki$(echo .)fi \
    --cc=trast@student$(echo .)ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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