diff --git a/autoload/flog/git.vim b/autoload/flog/git.vim index dc0b185..dc312cf 100644 --- a/autoload/flog/git.vim +++ b/autoload/flog/git.vim @@ -12,7 +12,7 @@ function! flog#git#GetWorkdirFrom(git_dir) abort let l:parent = fnamemodify(a:git_dir, ':h') " Check for core.worktree setting - let l:worktree = systemlist(l:cmd + ['config', '--get', 'core.worktree']) + let l:worktree = flog#shell#Systemlist(l:cmd + ['config', '--get', 'core.worktree']) if empty(v:shell_error) && !empty(l:worktree) let l:worktree = flog#path#ResolveFrom(l:parent, l:worktree[0]) if isdirectory(l:worktree) @@ -53,7 +53,7 @@ function! flog#git#GetWorkdirFrom(git_dir) abort endif " Check for non-worktree parent directory - call systemlist(l:cmd + ['-C', flog#shell#Escape(l:parent), 'rev-parse', '--show-toplevel']) + call flog#shell#Systemlist(l:cmd + ['-C', flog#shell#Escape(l:parent), 'rev-parse', '--show-toplevel']) if !empty(v:shell_error) return a:git_dir endif diff --git a/autoload/flog/shell.vim b/autoload/flog/shell.vim index 5e5337c..3588692 100644 --- a/autoload/flog/shell.vim +++ b/autoload/flog/shell.vim @@ -17,8 +17,21 @@ function! flog#shell#EscapeList(list) abort return map(copy(a:list), 'flog#shell#Escape(v:val)') endfunction +if has('nvim') || v:version > 704 || (v:version == 704 && get(v:, 'patchlevel', 0) >= 247) + function! flog#shell#Systemlist(cmd) abort + return systemlist(a:cmd) + endfunction +else + function! flog#shell#Systemlist(cmd) abort + if type(a:cmd) == v:t_list + return systemlist(join(a:cmd, ' ')) + endif + return systemlist(a:cmd) + endfunction +endif + function! flog#shell#Run(cmd) abort - let l:output = systemlist(a:cmd) + let l:output = flog#shell#Systemlist(a:cmd) if !empty(v:shell_error) call flog#print#err(join(l:output, "\n")) throw g:flog_shell_error