Specified branch not found after PlugInstall or PlugUpdate
Error logs:
fatal: invalid reference: ag-recursive-switch
Config:
Plug 'listenerri/vim-easygrep', { 'branch': 'ag-recursive-switch' }
Env:
- Ubuntu 20.04.5 LTS ( WSL v0.70.4.0 )
- VIM v8.1
- vim-plug latest
I have a similar issue, where I am installing on a fresh machine on macOS Ventura. Here is how it can be reproduced:
❯ cat .vimrc
set nocompatible
if empty(glob('~/.vim/autoload/plug.vim'))
silent! curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
❯ mkdir .vim
❯ mkdir .vim/plugins
❯ curl -fLo "${HOME}/.vim/autoload/plug.vim" --create-dirs \
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 83129 100 83129 0 0 851k 0 --:--:-- --:--:-- --:--:-- 902k
❯ cd .vim
❯ cp ../.dotfiles/.vim/coc-settings.json .
❯ cat coc-settings.json
{
"tsserver.log": "verbose",
"tailwindCSS.headwind.runOnSave": false,
"eslint.filetypes": [
"javascript",
"typescript",
"typescriptreact",
"javascriptreact",
"typescript.tsx"
],
"eslint.autoFixOnSave": false,
"diagnostic-languageserver.enable": true,
"diagnostic-languageserver.filetypes": {
"sh": "shellcheck"
},
"diagnostic.displayByAle": true,
"svelte.enable-ts-plugin": true
}
❯ ls -la
total 8
drwxr-xr-x@ 5 rommel staff 170 Nov 2 15:01 .
drwxr-xr-x 52 rommel staff 1768 Nov 2 15:01 ..
drwxr-x---@ 3 rommel staff 102 Nov 2 15:00 autoload
-rw-r--r--@ 1 rommel staff 425 Nov 2 15:01 coc-settings.json
drwxr-xr-x@ 2 rommel staff 68 Nov 2 15:00 plugins
❯ vim -es -u "${HOME}/.vimrc" -i NONE -c "PlugInstall" -c "qa"
❯ cd plugged/coc.nvim
❯ git branch -l |col -b
* master
❯ git branch -l -a |col -b
* master
remotes/origin/HEAD -> origin/master
remotes/origin/deps
remotes/origin/lua
remotes/origin/master
remotes/origin/release
❯
If I manually then go to that directory and git checkout the release branch, everything works. I ill try to look into it myself later today.
Found out, that it was because the cloned repository had problems on a case insensitive filesystem. The git checkout command itself broke. I do not believe that in my case vim-plug can do anything about it.
I was unable to reproduce the problem with this minimal vimrc.
call plug#begin()
Plug 'listenerri/vim-easygrep', { 'branch': 'ag-recursive-switch' }
call plug#end()
PlugInstall succeeds and the branch is correctly checked out.