mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-23 20:45:31 -07:00
parent
5d8c4bfc1f
commit
6575bd65b1
12
plug.vim
12
plug.vim
@ -1873,9 +1873,15 @@ function! s:progress_bar(line, bar, total)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:compare_git_uri(a, b)
|
function! s:compare_git_uri(a, b)
|
||||||
let a = substitute(a:a, 'git:\{1,2}@', '', '')
|
" See `git help clone'
|
||||||
let b = substitute(a:b, 'git:\{1,2}@', '', '')
|
" https:// [user@] github.com[:port] / junegunn/vim-plug [.git]
|
||||||
return a ==# b
|
" [git@] github.com[:port] : junegunn/vim-plug [.git]
|
||||||
|
" file:// / junegunn/vim-plug [/]
|
||||||
|
" / junegunn/vim-plug [/]
|
||||||
|
let pat = '^\%(\w\+://\)\='.'\%([^@/]*@\)\='.'\([^:/]*\%(:[0-9]*\)\=\)'.'[:/]'.'\(.\{-}\)'.'\%(\.git\)\=/\?$'
|
||||||
|
let ma = matchlist(a:a, pat)
|
||||||
|
let mb = matchlist(a:b, pat)
|
||||||
|
return ma[1:2] ==# mb[1:2]
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:format_message(bullet, name, message)
|
function! s:format_message(bullet, name, message)
|
||||||
|
@ -15,7 +15,8 @@ Execute (Initialize test environment):
|
|||||||
" Temporarily patch plug.vim
|
" Temporarily patch plug.vim
|
||||||
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
call system('cp "$PLUG_SRC" "$PLUG_TMP"')
|
||||||
call writefile(extend(readfile($PLUG_TMP),
|
call writefile(extend(readfile($PLUG_TMP),
|
||||||
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction']), $PLUG_TMP)
|
\ ['function! ResetPlug()', 'let s:loaded = {}', 'endfunction',
|
||||||
|
\ 'function! CompareURI(a, b)', 'return s:compare_git_uri(a:a, a:b)', 'endfunction']), $PLUG_TMP)
|
||||||
|
|
||||||
set t_Co=256
|
set t_Co=256
|
||||||
colo default
|
colo default
|
||||||
|
@ -1493,3 +1493,30 @@ Execute (#427 - Tag option with wildcard (requires git 1.9.2 or above)):
|
|||||||
q
|
q
|
||||||
AssertEqual '2.9.7', GitTag('vim-easy-align')
|
AssertEqual '2.9.7', GitTag('vim-easy-align')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Execute (#530 - Comparison of compatible git URIs):
|
||||||
|
" .git suffix
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/vim-plug')
|
||||||
|
|
||||||
|
" user@
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://user@github.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" git::@
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'https://git::@github.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" https and ssh
|
||||||
|
Assert CompareURI('https://github.com/junegunn/vim-plug.git', 'git@github.com:junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" file://
|
||||||
|
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug')
|
||||||
|
Assert CompareURI('file:///tmp/vim-plug', '/tmp/vim-plug/')
|
||||||
|
|
||||||
|
Execute (#530 - Comparison of incompatible git URIs):
|
||||||
|
" Different hostname
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://bitbucket.com/junegunn/vim-plug.git')
|
||||||
|
|
||||||
|
" Different repository
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com/junegunn/emacs-plug.git')
|
||||||
|
|
||||||
|
" Different port
|
||||||
|
Assert !CompareURI('https://github.com/junegunn/vim-plug.git', 'https://github.com:12345/junegunn/vim-plug.git')
|
||||||
|
Loading…
Reference in New Issue
Block a user