ingydotnet / git-subrepo

MIT License
3.18k stars 263 forks source link

zsh completion not working #592

Closed humblehacker closed 4 days ago

humblehacker commented 11 months ago

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.

perlpunk commented 11 months ago

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.

humblehacker commented 11 months ago

On which platform are you?

macOS 14

perlpunk commented 11 months ago

And which git version?

humblehacker commented 11 months ago

git version 2.41.0

perlpunk commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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.

humblehacker commented 11 months ago

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.

djr7C4 commented 11 months ago

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

admorgan commented 10 months ago

Can this be closed?