Provide argument list version of s:UserCommand()

This commit is contained in:
Tim Pope
2019-07-06 07:13:44 -04:00
parent d1671f1fce
commit 873ede7aa4

View File

@@ -171,24 +171,24 @@ endfunction
function! s:ChdirArg(dir) abort function! s:ChdirArg(dir) abort
endfunction endfunction
function! s:UserCommand(...) abort function! s:UserCommandList(...) abort
let git = get(g:, 'fugitive_git_command', g:fugitive_git_executable) let git = split(get(g:, 'fugitive_git_command', g:fugitive_git_executable), '\s\+')
let dir = a:0 ? s:Dir(a:1) : '' let dir = a:0 ? s:Dir(a:1) : ''
if len(dir) if len(dir)
let tree = s:Tree(dir) let tree = s:Tree(dir)
if empty(tree) if empty(tree)
let git .= ' --git-dir=' . s:shellesc(dir) call add(git, '--git-dir=' . dir)
elseif len(tree) && s:cpath(tree) !=# s:cpath(getcwd()) elseif len(tree) && s:cpath(tree) !=# s:cpath(getcwd())
if fugitive#GitVersion(1, 9) call extend(git, ['-C', tree])
let git .= ' -C ' . s:shellesc(tree)
else
let git = 'cd ' . s:shellesc(tree) . (s:winshell() ? '& ' : '; ') . git
endif
endif endif
endif endif
return git return git
endfunction endfunction
function! s:UserCommand(...) abort
return s:shellesc(call('s:UserCommandList', a:000))
endfunction
let s:git_versions = {} let s:git_versions = {}
function! fugitive#GitVersion(...) abort function! fugitive#GitVersion(...) abort
if !has_key(s:git_versions, g:fugitive_git_executable) if !has_key(s:git_versions, g:fugitive_git_executable)