Don't :cd if directory already correct

This commit is contained in:
Tim Pope 2018-07-24 01:37:50 -04:00
parent 240127f5a5
commit e6e3f3f225

View File

@ -122,9 +122,11 @@ function! s:TreeChomp(...) abort
try try
if !empty(tree) if !empty(tree)
if fugitive#GitVersion() =~# '^[01]\..*' if fugitive#GitVersion() =~# '^[01]\..*'
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd' if getcwd() !=# tree
let cwd = getcwd() let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
exe cd s:fnameescape(tree) let cwd = getcwd()
exe cd s:fnameescape(tree)
endif
else else
let args = ['-C', tree] + args let args = ['-C', tree] + args
endif endif