Merge pull request #476 from junegunn/tag-wildcard
Support wildcards in tag option
This commit is contained in:
commit
0507fc897e
4 changed files with 31 additions and 3 deletions
|
@ -89,6 +89,9 @@ Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
|
||||||
" Using a non-master branch
|
" Using a non-master branch
|
||||||
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
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
|
" Plugin options
|
||||||
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||||
|
|
||||||
|
|
17
plug.vim
17
plug.vim
|
@ -28,6 +28,9 @@
|
||||||
" " Using a non-master branch
|
" " Using a non-master branch
|
||||||
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
|
" 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
|
" " Plugin options
|
||||||
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
|
||||||
"
|
"
|
||||||
|
@ -966,8 +969,17 @@ function! s:update_finish()
|
||||||
call s:log4(name, 'Checking out '.spec.commit)
|
call s:log4(name, 'Checking out '.spec.commit)
|
||||||
let out = s:checkout(spec)
|
let out = s:checkout(spec)
|
||||||
elseif has_key(spec, 'tag')
|
elseif has_key(spec, 'tag')
|
||||||
call s:log4(name, 'Checking out '.spec.tag)
|
let tag = spec.tag
|
||||||
let out = s:system('git checkout -q '.s:esc(spec.tag).' 2>&1', spec.dir)
|
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
|
else
|
||||||
let branch = s:esc(get(spec, 'branch', 'master'))
|
let branch = s:esc(get(spec, 'branch', 'master'))
|
||||||
call s:log4(name, 'Merging origin/'.branch)
|
call s:log4(name, 'Merging origin/'.branch)
|
||||||
|
@ -2227,4 +2239,3 @@ endif
|
||||||
|
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
unlet s:cpo_save
|
unlet s:cpo_save
|
||||||
|
|
||||||
|
|
1
test/run
1
test/run
|
@ -104,6 +104,7 @@ select_vim() {
|
||||||
clone_repos
|
clone_repos
|
||||||
prepare
|
prepare
|
||||||
|
|
||||||
|
git --version
|
||||||
VIM=$(select_vim)
|
VIM=$(select_vim)
|
||||||
echo "Selected Vim: $VIM"
|
echo "Selected Vim: $VIM"
|
||||||
if [ "$1" = '!' ]; then
|
if [ "$1" = '!' ]; then
|
||||||
|
|
|
@ -1424,3 +1424,16 @@ Execute (#371 - 'as' option):
|
||||||
AssertEqual ['yogo'], sort(keys(g:plugs))
|
AssertEqual ['yogo'], sort(keys(g:plugs))
|
||||||
AssertEqual '/tmp/gogo/', g:plugs.yogo.dir
|
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
|
||||||
|
|
Loading…
Reference in a new issue