Skip to content

Support wildcards in tag option #476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-master branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }

" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' }

" Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }

Expand Down
17 changes: 14 additions & 3 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
" " Using a non-master branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
" Plug 'fatih/vim-go', { 'tag': '*' }
"
" " Plugin options
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
"
Expand Down Expand Up @@ -966,8 +969,17 @@ function! s:update_finish()
call s:log4(name, 'Checking out '.spec.commit)
let out = s:checkout(spec)
elseif has_key(spec, 'tag')
call s:log4(name, 'Checking out '.spec.tag)
let out = s:system('git checkout -q '.s:esc(spec.tag).' 2>&1', spec.dir)
let tag = spec.tag
if tag =~ '\*'
let tags = s:lines(s:system('git tag --list '.string(tag).' --sort -version:refname 2>&1', spec.dir))
if !v:shell_error && !empty(tags)
let tag = tags[0]
call s:log4(name, printf('Latest tag for %s -> %s', spec.tag, tag))
call append(3, '')
endif
endif
call s:log4(name, 'Checking out '.tag)
let out = s:system('git checkout -q '.s:esc(tag).' 2>&1', spec.dir)
else
let branch = s:esc(get(spec, 'branch', 'master'))
call s:log4(name, 'Merging origin/'.branch)
Expand Down Expand Up @@ -2227,4 +2239,3 @@ endif

let &cpo = s:cpo_save
unlet s:cpo_save

1 change: 1 addition & 0 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ select_vim() {
clone_repos
prepare

git --version
VIM=$(select_vim)
echo "Selected Vim: $VIM"
if [ "$1" = '!' ]; then
Expand Down
13 changes: 13 additions & 0 deletions test/workflow.vader
Original file line number Diff line number Diff line change
Expand Up @@ -1424,3 +1424,16 @@ Execute (#371 - 'as' option):
AssertEqual ['yogo'], sort(keys(g:plugs))
AssertEqual '/tmp/gogo/', g:plugs.yogo.dir

Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
if str2nr(split(split(system('git --version'))[-1], '\.')[0]) < 2
Log 'tag with wildcard requires git 1.9.2 or above'
else
call plug#begin()
Plug 'junegunn/vim-easy-align', { 'tag': '2.9.*' }
call plug#end()
PlugInstall!
Log getline(1, '$')
AssertExpect! '- Latest tag for 2.9.* -> 2.9.7 (vim-easy-align)', 1
q
AssertEqual '2.9.7', GitTag('vim-easy-align')
endif