From d8699755d4b641a9dfffd724f1831a4334dc1366 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 10 Apr 2020 23:40:03 -0400 Subject: [PATCH] Refactor s:clone_opt to a list Prep for using list type for command in s:spawn(). --- plug.vim | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/plug.vim b/plug.vim index 1471735..960ec67 100644 --- a/plug.vim +++ b/plug.vim @@ -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