# completion: checkout.* not being completed in zsh

3 messages from 2019-08-15 to 2019-08-17. Participants: Pratyush Yadav, brian m. carlson.
Thread: https://gitlist.dev/t/51649

## Pratyush Yadav, 2019-08-15 19:50

Subject: completion: checkout.* not being completed in zsh
Message-ID: <20190815185901.btf4d7c4ewsccxuu@localhost.localdomain>
URL: https://gitlist.dev/e/20190815185901.btf4d7c4ewsccxuu%40localhost.localdomain

```
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, 2019-08-16 02:36

Subject: Re: completion: checkout.* not being completed in zsh
Message-ID: <20190816023649.GB365197@genre.crustytoothpaste.net>
URL: https://gitlist.dev/e/20190816023649.GB365197%40genre.crustytoothpaste.net
In-Reply-To: <20190815185901.btf4d7c4ewsccxuu@localhost.localdomain>

```
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?
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

```

## Pratyush Yadav, 2019-08-17 14:00

Subject: Re: completion: checkout.* not being completed in zsh
Message-ID: <20190817140009.4kelg4yiybb4xphn@localhost.localdomain>
URL: https://gitlist.dev/e/20190817140009.4kelg4yiybb4xphn%40localhost.localdomain
In-Reply-To: <20190816023649.GB365197@genre.crustytoothpaste.net>

```
On 16/08/19 02:36AM, brian m. carlson wrote:
> 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

```
