-
-
Notifications
You must be signed in to change notification settings - Fork 25.7k
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 completion fails when complete_aliases option is set #2394
Comments
👍 Same issue exactly... very puzzling. |
Interesting. For the lazy, here is what the Zsh guide has to say about
However, since 57f55e6 and 2e94929, the aliases from the git plugin have their own completion set, and redirected to the proper git subcommand, including Finally, I am not able to reproduce the issue with Zsh 5.0.2 on Mac 10.9.2: @slhck @mecampbellsoup can you try with the template Also @mecampbellsoup can you post your system config and Zsh version? @mcornella @simonweil (my happy helpers =D) can you try to reproduce the issue? |
I'm now on Zsh 5.0.5 with oh-my-zsh As soon as I include |
@ncanceill Sure, here you go: ⇒ zsh --version
zsh 5.0.5 (x86_64-apple-darwin13.0.0)⇒ zsh --version
zsh 5.0.5 (x86_64-apple-darwin13.0.0) My full oh-my-zsh version is |
No idea.. maybe compinit cache fault? If so, try deleting the files |
@mcornella That didn't help, unfortunately. |
@slhck I think perhaps we should start checking out previous |
@mecampbellsoup yes, that could be helpful! I recommend the use of The non-reproducibility of the issue suggests that it has something to do with your config, and the fact that it still happens with the template Let us start with determining what the
But then I had a look at the Zsh git completion (with the oh-so-evil 6661 line count), and @pielgrzym can you enlighten us about 2e94929? |
Nice digging @ncanceill!
It is indeed checked for inside the if [[ $service == git ]]; then
[...]
else
_call_function ret _$service
fi so it then calls (( $+functions[_git-checkout] )) ||
_git-checkout () { [...] } Maybe they both have a custom BTW, the source you linked was from the master branch, here are both 5.0.4 and 5.0.5 |
Thanks @mcornella, I found the check for I like your hint about Concerning the weird output, I have seen |
One last thing, using |
@ncanceill @mcornella So here's some some output for you, both are taken after attempting tab completion: matthewcampbell@Matthews-MacBook-Air:~/Sites/code/stack-builders/seo_platform|69220108_adjust_keyword_editing_on_dealer⚡
⇒ gco ......zsh:12: command not found: __git-checkout_main ⇒ git checkout
67061970_notify_sidekiq_hangs origin/67061970_notify_sidekiq_hangs production
67394702_track_keywords_change origin/67394702_track_keywords_change production_2014-04-21 (P.S. This is the same as the output when I just have And when I ask about ⇒ which _git-checkout
_git-checkout not found ⇒ which __git-checkout
__git-checkout not found |
Try this: autoload -Uz _git-checkout && _git-checkout
which _git-checkout Sorry, but it didn't become clear if the issue appeared using just Also, try disabling OMZ entirely: that is, using a blank And one last thing, does the same thing happen in another git repository? |
@mcornella More output for ya': ⇒ autoload -Uz _git-checkout && _git-checkout
zsh: _git-checkout: function definition file not found ⇒ which _git-checkout
_git-checkout () {
# undefined
builtin autoload -XUz
} It appears that basically all of my Git completion functions are broken, by the way (I have to ⇒ ga ......zsh:12: command not found: __git-add_main
⇒ gco ......zsh:12: command not found: __git-checkout_main
⇒ gd ......zsh:12: command not found: __git-diff_main
⇒ gst ......zsh:12: command not found: __git-status_main I'm at quite the loss. Let me know what else I can do to help. |
@mcornella Another super weird thing going on in my setup is the results of my ⇒ where ruby
ruby: aliased to bundled_ruby
/Users/matthewcampbell/.rbenv/shims/ruby
/Users/matthewcampbell/.rbenv/shims/ruby
/usr/bin/ruby ⇒ where coqc
/usr/local/bin/coqc
/usr/local/bin/coqc
/usr/local/bin/coqc
/usr/local/bin/coqc Why would ZSH be returning me the same result 4 times?! |
Ok, bear with me, one last time: autoload -Uz _git && _git
which _git-checkout and echo '$fpath = ('$fpath')'
echo '$path = ('$path')' Also, try what I mentioned about using an empty |
⇒ autoload -Uz _git && _git
zsh:12: command not found: ___main
_default:compcall:12: can only be called from completion function ⇒ which _git-checkout
_git-checkout not found ⇒ echo '$fpath = ('$fpath')'
$fpath = (/Users/matthewcampbell/.oh-my-zsh/plugins/gem /Users/matthewcampbell/.oh-my-zsh/plugins/brew /Users/matthewcampbell/.oh-my-zsh/plugins/bundler /Users/matthewcampbell/.oh-my-zsh/plugins/git /Users/matthewcampbell/.oh-my-zsh/functions /Users/matthewcampbell/.oh-my-zsh/completions /Users/matthewcampbell/.dotfiles/zsh /Users/matthewcampbell/.dotfiles/xcode /Users/matthewcampbell/.dotfiles/vim /Users/matthewcampbell/.dotfiles/tmux /Users/matthewcampbell/.dotfiles/system /Users/matthewcampbell/.dotfiles/sublime2 /Users/matthewcampbell/.dotfiles/script /Users/matthewcampbell/.dotfiles/ruby /Users/matthewcampbell/.dotfiles/python /Users/matthewcampbell/.dotfiles/osx /Users/matthewcampbell/.dotfiles/macvim /Users/matthewcampbell/.dotfiles/homebrew /Users/matthewcampbell/.dotfiles/git /Users/matthewcampbell/.dotfiles/functions /Users/matthewcampbell/.dotfiles/ctags /Users/matthewcampbell/.dotfiles/cloudapp /Users/matthewcampbell/.dotfiles/bin /Users/matthewcampbell/.dotfiles/functions /usr/local/share/zsh/site-functions /usr/local/Cellar/zsh/5.0.5/share/zsh/functions) ⇒ echo '$path = ('$path')'
$path = (/Users/matthewcampbell/.rbenv/shims /usr/local/opt/coreutils/libexec/gnubin /usr/local/bin /Users/matthewcampbell/.cabal/bin /Applications/Postgres93.app/Contents/MacOS/bin /usr/local/bin /usr/local/heroku/bin ./bin /Users/matthewcampbell/.rbenv/shims /usr/local/bin /usr/local/sbin /Users/matthewcampbell/.sfs /Users/matthewcampbell/.dotfiles/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin /opt/X11/bin /usr/local/go/bin /usr/local/MacGPG2/bin /Users/matthewcampbell/.rbenv/shims /usr/local/opt/coreutils/libexec/gnubin /Users/matthewcampbell/.cabal/bin /Applications/Postgres93.app/Contents/MacOS/bin /usr/local/heroku/bin ./bin /usr/local/sbin /Users/matthewcampbell/.sfs /Users/matthewcampbell/.dotfiles/bin /usr/local/Cellar/go/1.2.1/bin /usr/local/Cellar/go/1.2.1/bin)
Matthews-MacBook-Air% autoload -Uz _git-checkout && _git-checkout
zsh: _git-checkout: function definition file not found
Matthews-MacBook-Air% gd
zsh: command not found: gd
Matthews-MacBook-Air% gst
zsh: command not found: gst
Matthews-MacBook-Air% gco
zsh: command not found: gco Looks like completion is not persisting... |
This confirms the issue happens with every git completion, I guess there's something wrong with
When you use zsh without oh-my-zsh, don't use the aliases but the full git command, since aliases are not defined without oh-my-zsh. You can navigate to a git repository and input any git command (e.g. Also, it appears you have duplicate entries in your $path; to enforce unique values add the command |
Thanks @mcornella, very helpful for me. ⇒ which _git
_git () {
local _ret=1
local cur cword prev
cur=${words[CURRENT]}
prev=${words[CURRENT-1]}
let cword=CURRENT-1
if (( $+functions[__${service}_zsh_main] ))
then
__${service}_zsh_main
else
emulate ksh -c __${service}_main
fi
let _ret && _default && _ret=0
return _ret
}
When I use the full ⇒ git checkout <TAB>
64879538_fix_li_elements master origin/master
64908958_center_products_text_in_div next_ror_post origin/next_ror_post
64916916_fix_contact_emails origin/64879538_fix_li_elements origin/oss_contrib_blog_post
64919128_override_fonts origin/64908958_center_products_text_in_div origin/production
65271680_fix_map_resizing origin/64916916_fix_contact_emails origin/sprites
65753620_translate_navigation_bar origin/64919128_override_fonts origin/title-update-final In the past, when using Here's output when I've disabled OMZ and run the same Matthews-MacBook-Air% git checkout README.md
Procfile Setup.hs circle.yml dist/ node_modules/ stackbuilders.com.cabal
README.md assets/ client_session_key.aes news/ src/ tests/ It seems to be, well, broken, which makes sense since I've disabled the |
Ok, now we know where do these |
This is with ⇒ which _git
_git () {
# undefined
builtin autoload -XUz
} I don't seem to have that filepath - I have up to matthewcampbell@Matthews-MacBook-Air:~|
⇒ vim /usr/local/Cellar/zsh/5.0.5/share/zsh/functions/
VCS_INFO_adjust _dmidecode _matlab _snoop _zpty
VCS_INFO_bydir_detect _domains _md5sum _socket _zsh-mime-handler
VCS_INFO_check_com _dpatch-edit-patch _mdadm _sockstat _zstyle
VCS_INFO_detect_bzr _dpkg _members _softwareupdate _ztodo
VCS_INFO_detect_cdv _dpkg-buildpackage _mencal _sort _zypper |
Ok, the filepath must be Regarding |
Still can't locate that filepath brother... here's a Gist with the output of Here's ⇒ which _git
_git () {
local _ret=1
local cur cword prev
cur=${words[CURRENT]}
prev=${words[CURRENT-1]}
let cword=CURRENT-1
if (( $+functions[__${service}_zsh_main] ))
then
__${service}_zsh_main
else
emulate ksh -c __${service}_main
fi
let _ret && _default && _ret=0
return _ret
} |
Ok, I understand now how Homebrew installs I'm beginning to think this is an issue with your homebrew installation of zsh. Maybe you should uninstall it and reinstall it again.. Or ask the @Homebrew guys? |
https://gist.github.com/80a00d7af3766c1ad6dc @mcornella Do you think it could have something to do with the dotfiles I installed not too long ago? They're @holman's... https://github.com/mecampbellsoup/dotfiles/blob/master/zsh/config.zsh |
Well, you're installation of zsh is correct. It seems though you have some other place that's redefining your git completion, because your
That may be it yes. In this file it's sourcing a completion file, check that one out for me, please and thank you: @slhck, may that be the same issue, do you have @holman's dotfiles as well? |
@mcornella As a gist once again: https://gist.github.com/mecampbellsoup/fb74f902ccfe9cc5b6c5 |
Yes, that file is the culprit. The definition of the I don't know how you should proceed now. You could rename the file you just gisted so that your |
@mcornella Sorry, how do you explain this behavior exactly? I'm a bit confused :/ ⇒ which _git
_git () {
# undefined
builtin autoload -XUz
}
matthewcampbell@Matthews-MacBook-Air:~/.dotfiles|master⚡
⇒ ga
Nothing specified, nothing added.
Maybe you wanted to say 'git add .'?
matthewcampbell@Matthews-MacBook-Air:~/.dotfiles|master⚡
⇒ which _git
_git () {
local _ret=1
local cur cword prev
cur=${words[CURRENT]}
prev=${words[CURRENT-1]}
let cword=CURRENT-1
if (( $+functions[__${service}_zsh_main] ))
then
__${service}_zsh_main
else
emulate ksh -c __${service}_main
fi
let _ret && _default && _ret=0
return _ret
} |
For this behaviour you mean the different output of both |
And the correct behavior is likely being overwritten at some point, probably by something in my |
Yes, the file that loads the older completion is this file in your dotfiles. If you delete it you'll have the proper completion back. |
This looks a lot like you did |
@slhck you will find your fix in this comment: #2800 (comment) |
@mcornella Sorry for the late reply. I did not have access to the machine that exposed the problem. Running
solved the problem indeed. Thank you very much for your investigation. |
The problem here is that the official Git completion was not prepared for 'complete_aliases', I've pushed a fix: This way you can manually define the completion with:
However, if you want to use zsh's format:
|
find .zshrc and remove comment Example aliasesalias zshconfig="st ~/.zshrc" alias ohmyzsh="mate ~/.oh-my-zsh"alias gco="git checkout" |
ohmyzsh/ohmyzsh#2394 (comment) Unfortunately, it doesn't complete remote branches.
Can anyone help me debug why I'm getting this issue? It happens with and without I'm using Powerlevel10k on oh-my-zsh 173d4ca, with zsh 5.8 (x86_64-apple-darwin19.3.0) and git version 2.26.1. Unfortunately Here is my definition of
|
@jessrosenfield It's because you are missing a patch. I'm not sure if you are using the latest ohmyzsh, but there was some mismatch and my patch got reverted: |
I'm running zsh 5.0.4 on OS X 10.8 with oh-my-zsh
a38af27
with thegit
plugin. When I typegco <TAB>
, I get the following output:I've found the culprit to be the option
complete_aliases
. Once I turn it off, everything works as expected.What gives? Is there any option clash? I haven't changed my
.zshrc
in ages, and I've always hadcomplete_aliases
on.I don't particularly need this option but I guess there's some bug here.
The text was updated successfully, but these errors were encountered: