Refactor s:clone_opt to a list

Prep for using list type for command in s:spawn().
This commit is contained in:
Jan Edmund Lazo 2020-04-10 23:40:03 -04:00
parent 668bc0fd2a
commit d8699755d4
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -1086,11 +1086,16 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
let s:clone_opt = get(g:, 'plug_shallow', 1) ?
\ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''
let s:clone_opt = []
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
call add(s:clone_opt, '--no-single-branch')
endif
endif
if has('win32unix') || has('wsl')
let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input'
call extend(s:clone_opt, ['-c', 'core.eol=lf', '-c', 'core.autocrlf=input'])
endif
let s:submodule_opt = s:git_version_requirement(2, 8) ? ' --jobs='.threads : ''
@ -1426,7 +1431,7 @@ while 1 " Without TCO, Vim stack is bound to explode
else
call s:spawn(name,
\ printf('git clone %s %s %s %s',
\ has_tag ? '' : s:clone_opt,
\ has_tag ? '' : join(s:clone_opt, ' '),
\ prog,
\ plug#shellescape(spec.uri, {'script': 0}),
\ plug#shellescape(s:trim(spec.dir), {'script': 0})), { 'new': 1 })
@ -1466,7 +1471,7 @@ G_NVIM = vim.eval("has('nvim')") == '1'
G_PULL = vim.eval('s:update.pull') == '1'
G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1
G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)'))
G_CLONE_OPT = vim.eval('s:clone_opt')
G_CLONE_OPT = ' '.join(vim.eval('s:clone_opt'))
G_PROGRESS = vim.eval('s:progress_opt(1)')
G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads'))
G_STOP = thr.Event()
@ -2003,7 +2008,7 @@ function! s:update_ruby()
end
} if VIM::evaluate('s:mac_gui') == 1
clone_opt = VIM::evaluate('s:clone_opt')
clone_opt = VIM::evaluate('s:clone_opt').join(' ')
progress = VIM::evaluate('s:progress_opt(1)')
nthr.times do
mtx.synchronize do