vim-plug fails to PlugUpdate if no master branch exists
Managing Plug 'rdnetto/YCM-Generator' with :PlugUpdate fails with this error
x YCM-Generator: error: pathspec 'master' did not match any file(s) known to git.
YCM-Generator only has https://github.com/rdnetto/YCM-Generator stable and develop branches, not master. Vim-Plug assumes that i want master, which isn't the case. Whatever the current in-use branch is, is the one I want.
I'm using the latest from master now
41de3c713c0b82700bfcb50a45e9d7756a2cce96
- Type:
- [x] Bug
- [ ] Enhancement
- [ ] Feature Request
- [ ] Question
- OS:
- [x] All/Other
- [ ] Linux
- [ ] OS X
- [ ] Windows
- Vim:
- [x] Terminal Vim
- [x] GVim
- [x] Neovim
This is a duplicate of #288 and quoting from https://github.com/rdnetto/YCM-Generator#installation
For vim-plug users, add Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'} to your vimrc.
The idea was to prevent the case where the user manually checks out a non-default, experimental branch, forgets about it, and vim-plug stops updating the plugin. By explicitly specifying the name of the branch with master as the default allows vim-plug to easily verify the status of the clone. The obvious downside of this approach is that it doesn't work well with plugins that do not use master as their default branches. But since there are very few such plugins, I didn't bother to find a proper solution to it. I wonder if there's a way to find the default branch without contacting the remote again and without external bookkeeping.
Using @{upstream} might help here (via #546).
For GitHub at least, there is a gradual move away from the branch name master to main, described in github/renaming. Just had to add { 'branch': 'main' } to a Plug myself. Would it be easy to support that 1 exception?
The latest version of vim-plug tracks the default branch, so this should be fixed now.