threads / discuss / 51649

completion: checkout.* not being completed in zsh

Subject: completion: checkout.* not being completed in zsh

## tl;dr

3 messages between Aug 15, 2019 and Aug 17, 2019.

replies: 2people: 2as markdown or json

Pratyush Yadav· Aug 15, 2019, 19:50 UTC · lore
Hi everyone,

I just noticed that checkout.* is not being completed in zsh. I wanted to set checkout.defaultRemote, but zsh would not auto-complete it.

When I do:
$ git config check<Tab>
zsh does not auto-fill "checkout."

Doing the same in bash works, so the functionality is there, it just doesn't work in zsh.

Once I add checkout.defaultRemote to my git config, autocompletion starts working, but only for defaultRemote, even though checkout has two options: defaultRemote and optimizeNewBranch.

To make it clear, this is what happens once I have added checkout.defaultRemote to my config:

$ git config check<Tab> $ git config checkout. # Completes to "checkout.". Correct behaviour. $ git config checkout.<Tab>

# Completes to defaultRemote, even though it should ask between # defaultRemote and optimizeNewBranch $ git config checkout.defaultRemote

I tried looking at contrib/completion, and I can see that zsh completion works on top of bash completion, so I don't know why exactly it works for bash but not for zsh.

I am not too familiar with how these auto completion scripts work, so if someone can point me in the right direction, I'll see if I can figure out a fix and submit it here.

-- 
Regards,
Pratyush Yadav
brian m. carlson· Aug 16, 2019, 02:36 UTC · re: Pratyush Yadav · lore

Re: completion: checkout.* not being completed in zsh

On 2019-08-15 at 19:50:27, Pratyush Yadav wrote:
Show 7 quoted lines
> I tried looking at contrib/completion, and I can see that zsh completion
> works on top of bash completion, so I don't know why exactly it works
> for bash but not for zsh.
> 
> I am not too familiar with how these auto completion scripts work, so if
> someone can point me in the right direction, I'll see if I can figure
> out a fix and submit it here.

zsh uses its own completion system which is substantially different from the bash one and includes definitions for most programs shipped with it. Are you sure you're using the Git-shipped completions and not the ones shipped with zsh?

-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
Pratyush Yadav· Aug 17, 2019, 14:00 UTC · re: brian m. carlson · lore

Re: completion: checkout.* not being completed in zsh

On 16/08/19 02:36AM, brian m. carlson wrote:
Show 13 quoted lines
> On 2019-08-15 at 19:50:27, Pratyush Yadav wrote:
> > I tried looking at contrib/completion, and I can see that zsh completion
> > works on top of bash completion, so I don't know why exactly it works
> > for bash but not for zsh.
> > 
> > I am not too familiar with how these auto completion scripts work, so if
> > someone can point me in the right direction, I'll see if I can figure
> > out a fix and submit it here.
> 
> zsh uses its own completion system which is substantially different from
> the bash one and includes definitions for most programs shipped with it.
> Are you sure you're using the Git-shipped completions and not the ones
> shipped with zsh?

Yes, you are correct. I was using the zsh shipped completion. Using the git shipped completion fixes this. Thanks.

-- 
Regards,
Pratyush Yadav

← back to recent threads