git-subrepo icon indicating copy to clipboard operation
git-subrepo copied to clipboard

zsh completion not working

Open humblehacker opened this issue 2 years ago • 10 comments

I've installed git-subrepo by cloning the repo into ~/usr/src/git-subrepo. Then I've added source $HOME/usr/src/git-subrepo/.rc to my .zshrc file.

I can type git subr<tab> and it will complete to git subrepo but subsequent tab presses don't complete correctly. That is, I get a list of files instead of subcommands. If I instead call git-subrepo directly (with the -) and press tab, I get the correct set of subcommands.

Regular git commands complete correctly. For example, git submodule <tab> shows me the correct list of subcommands.

I'm sure it's probably some misconfiguration on my side, but I've tried a bunch of things and so far nothing is helping. Hopefully one of you has seen this before.

humblehacker avatar Jul 28 '23 19:07 humblehacker

On which platform are you? I have the same problem on openSUSE ~~Leap 15.5 (git 2.35.3) and~~ Tumbleweed (git 2.41.0). On debian (git 2.39.2) it works fine. There is probably something different in the git internal completion helpers that makes the difference.

edit: Correction, it works on Leap 15.5.

perlpunk avatar Jul 28 '23 21:07 perlpunk

On which platform are you?

macOS 14

humblehacker avatar Jul 28 '23 21:07 humblehacker

And which git version?

perlpunk avatar Jul 28 '23 21:07 perlpunk

git version 2.41.0

humblehacker avatar Jul 28 '23 21:07 humblehacker

Ok, that confirms what I thought. Looking into /usr/share/zsh/functions/Completion/Unix/_git in the different versions I see changes how _git_third_party_commands is handled. I would have to debug what's going on. Any help from git zsh completion experts welcome =)

perlpunk avatar Jul 28 '23 21:07 perlpunk

So in git 2.35.3 /usr/share/zsh/functions/Completion/Unix/_git is loaded once I type git s<tab>. In the newer git it is not loaded. @humblehacker do source /usr/share/zsh/functions/Completion/Unix/_git and then try a completion again.

Now to find out why it isn't loaded...

perlpunk avatar Jul 28 '23 22:07 perlpunk

btw, I also noticed recently that in the newer git advanced completion doesn't work either, so it's not only a problem with third party completions. for example git b<tab> would normally also list my aliases starting with b, in the newer git it only shows two subcommands, bisect and branch. Or doing git push fork :b<tab> would normally complete all remote branches starting with b.

I haven't gotten around investigating this.

perlpunk avatar Jul 28 '23 23:07 perlpunk

do source /usr/share/zsh/functions/Completion/Unix/_git and then try a completion again.

Mine was in a different directory (probably because macOS/homebrew), but when I source /usr/share/zsh/5.9/functions/_git completions do start working.

Looks like an unlucky coincidence that something broke in zsh git completions right at the time I installed git-subrepo for the first time.

Thanks for taking a look.

humblehacker avatar Jul 29 '23 14:07 humblehacker

Completions work for me with git 2.41.0, git-subrepo 0.4.6 and zsh 5.9.

djr7C4 avatar Aug 05 '23 20:08 djr7C4

Can this be closed?

admorgan avatar Sep 19 '23 21:09 admorgan