mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-15 06:43:51 -05:00
More helpful error on Git without -C
Closes https://github.com/tpope/vim-fugitive/issues/1283
This commit is contained in:
@@ -184,7 +184,11 @@ function! s:UserCommandList(...) abort
|
|||||||
if empty(tree)
|
if empty(tree)
|
||||||
call add(git, '--git-dir=' . 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, 8, 5)
|
||||||
call extend(git, ['-C', tree])
|
call extend(git, ['-C', tree])
|
||||||
|
else
|
||||||
|
throw 'fugitive: Git 1.8.5 or higher required to change directory'
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
return git
|
return git
|
||||||
@@ -349,7 +353,7 @@ function! s:BuildShell(dir, env, args) abort
|
|||||||
endfor
|
endfor
|
||||||
if empty(tree) || index(cmd, '--') == len(cmd) - 1
|
if empty(tree) || index(cmd, '--') == len(cmd) - 1
|
||||||
call insert(cmd, '--git-dir=' . a:dir)
|
call insert(cmd, '--git-dir=' . a:dir)
|
||||||
elseif fugitive#GitVersion(1, 9)
|
elseif fugitive#GitVersion(1, 8, 5)
|
||||||
call extend(cmd, ['-C', tree], 'keep')
|
call extend(cmd, ['-C', tree], 'keep')
|
||||||
else
|
else
|
||||||
let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? '& ' : '; ') . pre
|
let pre = 'cd ' . s:shellesc(tree) . (s:winshell() ? '& ' : '; ') . pre
|
||||||
|
|||||||
Reference in New Issue
Block a user