Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git plugin autocomplete goes away when github plugin enabled #4670

Closed
patcon opened this issue Dec 5, 2015 · 10 comments
Closed

git plugin autocomplete goes away when github plugin enabled #4670

patcon opened this issue Dec 5, 2015 · 10 comments

Comments

@patcon
Copy link

patcon commented Dec 5, 2015

This isn't urgent for me, as I've disabled the github plugin, but just wanted to log the bug :)

Details here: #4443 (comment)

cc: @apjanke

@patcon
Copy link
Author

patcon commented Dec 5, 2015

Also, I've confirmed that I don't have zsh-completions installed via any of the methods explained in the link below:

https://github.com/zsh-users/zsh-completions#usage

@apjanke
Copy link
Contributor

apjanke commented Dec 5, 2015

Do you have the completealiases shell option set?

I think this makes sense. When git was defined as a function, the zsh autocompletion system will complete the command as git. Now that it's an alias post-#4443, autocompletion will "look inside" the alias and see that the actual command is hub, and will complete for hub instead.

It seems like you should still be getting completions, though, since hub supplies its own _hub completion definitions. What version of hub do you have installed? I'm on OS X 10.9.5 with zsh hub 2.2.2. If I load the github plugin, git completions still work, and they include the hub-specific extensions.

$ uname -a
Darwin eilonwy.local 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64
[~]
$ git --version
git version 2.6.3
hub version 2.2.2
[~]
$ git br
branch                  -- list, create, or delete branches
branch  browse

Maybe the github plugin needs to do something to add support for older hub versions, or at least detect them and complain if there's an incompatibility? Are some people stuck on older versions of hub?

@patcon
Copy link
Author

patcon commented Dec 5, 2015

Hm. Not sure what's up, I don't have that shell opt set, and my hub version is now up-to-date

$ cat ~/.zshrc | grep plugins=                           
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git github rails)
$ git --git-dir ~/.oh-my-zsh/.git rev-parse HEAD         
c82f49e734973debfcab9dd7f1a76bfd42186880
$ getopt completealiases                                 
 --
$ hub --version                                          
git version 2.1.1
hub version 2.2.2
$ git checkout
Berksfile         COMPATIBILITY.md  Gemfile.lock      README.md         TODO.md           attributes/       libraries/        spec/                                             
Berksfile.lock    CONTRIBUTING.md   Guardfile         Rakefile          VAGRANT.md        chefignore        metadata.rb       templates/                                        
CHANGELOG.md      Gemfile           LICENSE           TESTING.md        Vagrantfile       cookbooks/        recipes/          test/    

Anyhow, it's perhaps the case that I'm a special snowflake, in which case this isn't worth wasting any of your time with. Just wanted to open an issue in case someone else comes along and it proves to be a larger concern :)

@apjanke
Copy link
Contributor

apjanke commented Dec 6, 2015

I don't have that shell opt set

Okay. Having it off is the default, which means the "see in to the aliases to the underlying command" is the behavior you're getting. Just wanted to check.

Anyhow, it's perhaps the case that I'm a special snowflake, in which case this isn't worth wasting any of your time with. Just wanted to open an issue in case someone else comes along and it proves to be a larger concern :)

Nah, this is something we should understand and (if needed), fix. I want to start using the hub stuff myself (and I made that recent change to the github plugin), so I don't mind digging in to it.

Are all of the git completions broken for you? Or just certain ones? E.g. if you do git st<tab>, does it offer you the basic completions for status and other core commands?

And if you want to pursue this, could you run omz_diagnostic_dump and post the results as a gist, so I can get a detailed look at your shell settings and see if there are other things that might be interacting with this?

Could you also try doing set -x and then attempting to do a couple completions? That will give a zsh trace of all the commands and functions it's running as a result of the completion request. (And IIRC, @mcornella knows an even better trick for tracing/debugging completions specifically.)

@patcon
Copy link
Author

patcon commented Dec 6, 2015

Aw hey, thanks man!

omz_diagnostic_dump output:
https://gist.github.com/patcon/57ec79a9f5a7dee46b5f

And here's the output of one git and one hub autocompletion TABing (2 log files in gist):
https://gist.github.com/patcon/3081cd388c509cd5e6fd

:)

@Kayant
Copy link

Kayant commented Dec 8, 2015

I also have this problem. Am now using a different zsh framework zplug now but the issue was/is the same. It seems to be due to the way the wrapper works as even just following the instructions from https://github.com/github/hub the same thing happens. To note it breaks all the git completions.

I just aliased hub to github for now although I think I will give it :)

@mcornella
Copy link
Member

I can reproduce this, that's because git is aliased to hub, so zsh will try to find a _hub function to complete it. We're currently not shipping the _hub completion file within the github plugin, so zsh will fail to find a suitable completion function.

The quick hack is to force the git alias to use _git using a compdef, but that won't enable hub's custom commands, so I'm copying the hub completion file and shipping it within the plugin. So I've submitted PR #4695, please try it and I'll quickly merge it if it works ok.

@Kayant
Copy link

Kayant commented Dec 15, 2015

Thanks for your work will test tomorrow and report how it works.

@patcon
Copy link
Author

patcon commented Dec 15, 2015

🎆 Yay!

@patcon patcon closed this as completed Dec 15, 2015
@Kayant
Copy link

Kayant commented Dec 16, 2015

Fixes the issue for me on on-my-zsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants