mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-23 20:45:31 -07:00
Allow cloning into an empty directory (#782)
Close #766 We can rely on git to check if the destination directory is empty.
This commit is contained in:
parent
7f8fdd0444
commit
b6050d6f03
2
plug.vim
2
plug.vim
@ -1331,7 +1331,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
|
|
||||||
let name = keys(s:update.todo)[0]
|
let name = keys(s:update.todo)[0]
|
||||||
let spec = remove(s:update.todo, name)
|
let spec = remove(s:update.todo, name)
|
||||||
let new = !isdirectory(spec.dir)
|
let new = empty(globpath(spec.dir, '.git', 1))
|
||||||
|
|
||||||
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
|
||||||
redraw
|
redraw
|
||||||
|
@ -1511,7 +1511,7 @@ Execute (Commit hash support):
|
|||||||
Log getline(1, '$')
|
Log getline(1, '$')
|
||||||
AssertEqual 'x goyo.vim:', getline(5)
|
AssertEqual 'x goyo.vim:', getline(5)
|
||||||
AssertEqual ' fatal: invalid reference: ffffffff', getline(6)
|
AssertEqual ' fatal: invalid reference: ffffffff', getline(6)
|
||||||
AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf...')
|
AssertEqual 0, stridx(getline(7), '- vim-emoji: HEAD is now at 9db7fcf')
|
||||||
|
|
||||||
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
let hash = system(printf('cd %s && git rev-parse HEAD', g:plugs['vim-emoji'].dir))[:-2]
|
||||||
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
AssertEqual '9db7fcfee0d90dafdbcb7a32090c0a9085eb054a', hash
|
||||||
@ -1638,3 +1638,15 @@ Execute (#532 - Reuse plug window):
|
|||||||
AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
|
AssertEqual 2, winnr(), 'Current window is #2 after PlugStatus (but is '.winnr().')'
|
||||||
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
|
AssertEqual 2, winnr('$'), 'Three windows after PlugStatus (but got '.winnr('$').')'
|
||||||
q
|
q
|
||||||
|
|
||||||
|
Execute (#766 - Allow cloning into an empty directory):
|
||||||
|
let d = '/tmp/vim-plug-test/goyo-already'
|
||||||
|
call system('rm -rf ' . d)
|
||||||
|
call mkdir(d)
|
||||||
|
call plug#begin()
|
||||||
|
Plug 'junegunn/goyo.vim', { 'dir': d }
|
||||||
|
call plug#end()
|
||||||
|
PlugInstall
|
||||||
|
AssertExpect! '[=]', 1
|
||||||
|
q
|
||||||
|
unlet d
|
||||||
|
Loading…
Reference in New Issue
Block a user