junegunn / vim-plug

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

Failed to compare with the origin when PlugClean. #1283

Closed Davtrap21 closed 1 month ago

Davtrap21 commented 1 month ago

Hi, every time I try to PlugClean it prompts me to delete the directories of every single installed plugin, not only the ones missing from the list, and the message:

Failed to compare with the origin. The default branch might have changed.

I tried to fix everything I knew I changed in my hand to see if I broke the manager; folder sharing, outdated git, vim-plug or NeoVim, firewall rules, VPN...

I use a .vim file for vim-plug only, and init.lua for configs, setups and to source the vim file. Although I thought that could be an issue, I have a similar if not the same setup in a laptop with the same OS, and the old git, NeoVim and vim-plug versions I had in my main computer. PlugClean works perfectly there.

I've been trying to solve it on my own for some time but now but I finally ran out of ideas, I don't know if I screwed the manager up or if this is a bug, what am I missing?

Additional note

I kept the same versions for git and NeoVim since the problem started, I never updated till the day of this issue writing. The only I think I updated was vim-plug. Old versions were 0.9.5 release for NeoVim and 2.35.X.windows.2 for git. New version of NeoVim is listed below (:version), new git version is 2.45.2.windows.1.

Thought this might be important.


call plug#begin()

Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'ellisonleao/gruvbox.nvim'
Plug 'Mofiqul/vscode.nvim'
Plug 'nvim-lualine/lualine.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'mfussenegger/nvim-jdtls'
Plug 'neovim/nvim-lspconfig'
Plug 'joshdick/onedark.vim'
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-fugitive'
" Plug 'nvim-java/nvim-java'
" Plug 'mfussenegger/nvim-dap'
Plug 'Djancyp/better-comments.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
Plug 'nvim-lua/plenary.nvim'
Plug 'jxm35/livecode.nvim'
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.6' }
Plug 'Decodetalkers/csharpls-extended-lsp.nvim'
Plug 'jakobkhansen/journal.nvim'

call plug#end()
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
junegunn commented 1 month ago

Can you test this command in one of the plugin's directory? (e.g. :echo g:plugs['coc.nvim'].dir)

git rev-list --count --left-right HEAD...origin/master

# or this if the default branch is main
git rev-list --count --left-right HEAD...origin/main
Davtrap21 commented 1 month ago

Command output in coc directory:

PS C:/.../nvim-data/plugged/coc.nvim> git rev-list --count --left-right HEAD...origin/master
1   1
junegunn commented 1 month ago

The output looks fine. Can you test it again inside Vim like so?

:execute 'cd' g:plugs['coc.nvim'].dir | echo system('git rev-list --count --left-right HEAD...origin/master') | echo v:shell_error
Davtrap21 commented 1 month ago

Output is:

C:\Users\funti\AppData\Local\nvim-data\plugged\coc.nvim
1       1
0
junegunn commented 1 month ago

My guess is that you're using an old version of powershell as your &shell, right?

Can you check if b98b66242bf6ec28c256ddff2a274e2e7a43d832 fixes the problem?

FWIW, I had to follow the guide in :help shell-powershell to make :PlugDiff work, but without Remove-Alias because it's not available on powershell 5.

Davtrap21 commented 1 month ago

I was using powershell 5.1.

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  4046

b98b66242bf6ec28c256ddff2a274e2e7a43d832 solved the issue, no more failed messages and finally only prints plugins not in list, thank you very much for your help and fast responses, really appreciate it a lot!

junegunn commented 1 month ago

Thanks!