Fix shelling out from subdirectory
Closes https://github.com/tpope/vim-fugitive/issues/1061
This commit is contained in:
parent
5879304769
commit
93f29cf831
@ -117,12 +117,24 @@ function! fugitive#Prepare(...) abort
|
||||
endfunction
|
||||
|
||||
function! s:TreeChomp(...) abort
|
||||
let args = ['--git-dir=' . b:git_dir] + a:000
|
||||
let args = a:000
|
||||
let tree = FugitiveTreeForGitDir(b:git_dir)
|
||||
try
|
||||
if !empty(tree)
|
||||
call insert(args, '--work-tree=' . tree)
|
||||
if fugitive#GitVersion() =~# '^[01]\..*'
|
||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
|
||||
let cwd = getcwd()
|
||||
exe cd s:fnameescape(tree)
|
||||
else
|
||||
let args = ['-C', tree] + args
|
||||
endif
|
||||
endif
|
||||
return s:sub(s:System(call('fugitive#Prepare', args)),'\n$','')
|
||||
finally
|
||||
if exists('l:cd')
|
||||
exe cd s:fnameescape(cwd)
|
||||
endif
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
let s:git_versions = {}
|
||||
|
Loading…
Reference in New Issue
Block a user