Re: [PATCH 1/2] parse-options: support --git-completion-helper

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

 



On Wed, Jan 17, 2018 at 1:25 AM, Jacob Keller <jacob.keller@xxxxxxxxx> wrote:
> On Tue, Jan 16, 2018 at 2:36 AM, Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> wrote:
>> This option is designed to be used by git-completion.bash. For many
>> simple cases, what we do in there is usually
>>
>>     __gitcomp "lots of completion options"
>>
>> which has to be manually updated when a new user-visible option is
>> added. With support from parse-options, we can write
>>
>>     __gitcomp "$(git command --git-completion-helper)"
>>
>> and get that list directly from the parser for free. Dangerous/Unpopular
>> options could be hidden with the new "NO_GITCOMP" flag.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
>
> Was this possibly avoided in the past due to being slower than simply
> storing the list in the completion code itself?

At least on linux I would not worry too much about performance (but
then I don't know what platforms this git-completion supports and
whether this may become real performance problems for them).
git-completion.bash already executes some heavy commands (getting refs
for completion for example), though this makes the script call git
much earlier.

There's one thing I will have to be careful about though, that to make
sure that --git-completion-helper runs even if the command itself is
not supposed to run, e.g. calling git-status without a worktree will
fail, but calling 'git status --git-completion-helper' should still
work in that condition.

-- 
Duy




[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]

  Powered by Linux