junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.89k stars 1.9k forks source link

Specified branch not found after PlugInstall or PlugUpdate #1219

Closed listenerri closed 5 months ago

listenerri commented 1 year ago

Error logs:

fatal: invalid reference: ag-recursive-switch

Config:

Plug 'listenerri/vim-easygrep', { 'branch': 'ag-recursive-switch' }

Env:

michaelrommel commented 1 year ago

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.

michaelrommel commented 1 year ago

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.

junegunn commented 5 months ago

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.