Re: [PATCH] git-completion: Add git help completion for aliases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin <Johannes.Schindelin@xxxxxx> writes:

>> > 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?
>
> Yes. And if you use a lot of aliases, or a lot of machines with evolving 
> aliases, the easiest way to inspect the alias is "git help <alias>". Not 
> seeing it completed is an unexpected behavior.

I've queued the patch and I already said that this is not wrong, but I
think your argument cuts it both ways.

I have "co" aliased to "checkout", but with this change "git help co<TAB>"
now will interfere with my expectation that it would complete to commit,
config and the like, but exclude an alias that I myself defined and know
how to spell but forgot what its exact definition was, in order to avoid
cluttering the choices offered.

This is a constructive tangent but if we are going to run $(__git_aliases)
every time we run _git_help, perhaps it would want a hack similar to the
way the value for $__git_all_commands is generated just once?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]