black icon indicating copy to clipboard operation
black copied to clipboard

No branch stable to install Vim plugin with vim-plug

Open lcheylus opened this issue 4 years ago • 5 comments

According to the docs, to install Vim plugin with vim-plug, we must use branch stable. But there is no (more ?) branch stable only a tag.

.vimrc file : Plug 'psf/black', { 'branch': 'stable' }

When I try to install the plugin with :PlugInstall command, I have this error : Invalid branch HEAD (expected: stable).

If I modify my Vim configuration to use tag instead of branch, it works as expected (Vim plugin installed and black tool installed in virtualenv) : Plug 'psf/black', { 'tag': 'stable' }

Please recreate stable branch or modify doc to install Vim plugin : use tag instead of branch with vim-plug.

  • Version: Black, version 21.9b0 on Python 3.9.7 (default, Sep 3 2021, 06:18:44)
  • OS and Python version: Debian testing (bookworm) amd64, Python 3.9.7

lcheylus avatar Sep 21 '21 12:09 lcheylus

Be aware that vim-plug does not force override local tags with modified remote tags. Because the remote psf/black repo deletes and recreates their stable tags, local copies will not stay in sync.

If you want to track the non-stationary stable tag instead tracking the main branch then you'll need to do something like:

$ cd "~/.vim/bundle/black"
$ git fetch --tags --force

Modify the directory to match PLUGIN_DIRECTORY in the call plug#begin(PLUGIN_DIRECTORY) line near the top of your ~/.vimrc or ~/.config/nvim/init.vim.

pfheatwole avatar Nov 29 '21 18:11 pfheatwole

~~I have a different error trying to use vim-plug, both using tag and branch: Plug 'psf/black', { 'tag': 'stable' }~~

~~firts time it works. it installs black and it's usable, but next updates return error: merge: origin/stable - not something we can merge~~

~~docs say i should run this command, but it doesn't work:~~

$ git checkout origin/stable -b stable
fatal: 'origin/stable' is not a commit and a branch 'stable' cannot be created from it

~~repo information (cloned by vim-plug):~~

~/.local/share/nvim/plugged/black (tags/21.12b0) $ g status
HEAD detached at stable
nothing to commit, working tree clean

EDIT: tag solution works

Fogapod avatar Jan 06 '22 19:01 Fogapod

This seems potentially related. I I thought I had updated in the past without problems.

:PlugUpdate

merge: origin/stable - not something we can merge

Removing and reinstalling fixes it.

rm -Rf .vim/plugged/black

:PlugInstall

But then running updated again breaks it with the same message (whether or not anything changed).

My vim-plug configuration is:

Plug 'psf/black', {'branch': 'stable'}

That is what is in the documentation. Changing to tag fixes it.

Plug 'psf/black', {'tag': 'stable'}

I will see if I can put in a pull request for a small text change in the documentation.

KevinWhalen avatar Jul 25 '22 17:07 KevinWhalen

If stable could just go back to being a branch like it was before, that would be lovely. The proposed change to documentation to use {'tag': 'stable'} in vim-plug is rather misleading, because the effect is that you will be stuck on whatever stable happened to be when you first install the plugin, unless you manually go into your plugin directory and delete the tag every time you want to update. If stable were a branch, then vim-plug is able to update it with new commits from that branch as normal. I think this behavior is both surprising and undesirable for users, and defeats the purpose of having a moving stable that users are encouraged to refer to, rather than specific version tags that never change. A branch is the right tool for a reference in git that moves from time to time, even if it's only fast-forwarded from release to release, rather than where new commits are added.

chrisnc avatar Jul 27 '22 07:07 chrisnc

I agree. Matter of fact, I plan on converting stable back into a branch for the next release (see #3163) since we've been running into issues with RTD ever since we switched to a tag.

ichard26 avatar Jul 27 '22 21:07 ichard26

stable is now a branch once again since 22.8.0.

ichard26 avatar Sep 01 '22 00:09 ichard26