vim-plug icon indicating copy to clipboard operation
vim-plug copied to clipboard

Wildcard tag doesn't play well with `:PlugUpdate` when tags are detached ones.

Open autozimu opened this issue 7 years ago • 3 comments

(I was under the impression that this plugin supports wildcard tag releases properly, so correct me if I am wrong.)

:PlugUpdate seems won't fetch latest tags when the plugin has property of wildcard tag.

With this minimal vimrc

call plug#begin('~/.vim/plugged')
Plug 'autozimu/plug-wildcard', {'tag': 'release-*'}
call plug#end()
  1. Run :PlugInstall. This will install the plugin properly.
  2. Make a newer release in the repo, say release-0.2. The tag is slightly irregular. It works like this
# make changes
git commit -m 'new release'
git push --tags

(Note at this point, only tags are pushed. Current branch HEAD is not pushed.) 3. Run :PlugUpdate.

At this point, the plugin is not updated, while it is expected to update to release-0.2.

(This affects https://github.com/autozimu/LanguageClient-neovim/issues/239)


Neovim version

NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector --param ssp-buffer-size=4 -Wno-array-bounds -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/opt/neovim/build/config -I/opt/neovim/src -I/opt/neovim/.deps/usr/include -I/opt/neovim/.deps/usr/include -I/opt/neovim/.deps/usr/include -I/opt/neovim/.deps/usr/include -I/opt/neovim/.deps/usr/include -I/opt/neovim/.deps/usr/include -I/nix/store/s96g9b8rl9ab13v1by7n661h0hzpbgsw-glibc-2.25-49-dev/include -I/opt/neovim/build/src/nvim/auto -I/opt/neovim/build/include

Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info
  • Type:
    • [x] Bug
    • [ ] Enhancement
    • [ ] Feature Request
    • [ ] Question
  • OS:
    • [ ] All/Other
    • [x] Linux
    • [ ] OS X
    • [ ] Windows
  • Vim:
    • [ ] Terminal Vim
    • [ ] GVim
    • [x] Neovim

Edit: only detached tags can reproduce this issue.

autozimu avatar Jan 05 '18 03:01 autozimu

Looks like it is due to default git fetch behaviour.

Quote from git doc,

By default, any tag that points into the histories being fetched is also fetched; the effect is to fetch tags that point at branches that you are interested in. This default behavior can be changed by using the --tags or --no-tags options or by configuring remote..tagOpt. By using a refspec that fetches tags explicitly, you can fetch tags that do not point into branches you are interested in as well.

autozimu avatar Jan 05 '18 06:01 autozimu

Another related issue is that when using tag spec, it clones whole repo instead of a shadow clone. https://github.com/junegunn/vim-plug/blob/96375cb7d30b7caf2a9417799ff509b59b43a627/plug.vim#L1342

In use cases of https://github.com/autozimu/LanguageClient-neovim/tags, the whole purpose of using differnt tags for different binary distributions is to reduce users's initial download size.

autozimu avatar Jan 05 '18 06:01 autozimu

Thanks for the report. Looks like the method vim-plug internally uses does not work with "detached" tags. And the reason vim-plug does not perform shallow clone when tag is specified is to make it possible to switch to any tag in the history. The option was introduced to allow users to pick a stable release they want rather than to reduce the amount of data transfer, so I'd say this is working as intended.

I'm currently not committed to looking for a solution since I don't use any plugin that has the issue, and I don't have free time to work on this at the moment.

Patches are welcome, given that they don't make the code much more complex. Thanks.

junegunn avatar Jan 06 '18 06:01 junegunn