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
if !empty(tree)
if fugitive#GitVersion() =~# '^[01]\..*'
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
let cwd = getcwd()
exe cd s:fnameescape(tree)
if getcwd() !=# tree
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd' : 'cd'
let cwd = getcwd()
exe cd s:fnameescape(tree)
endif
else
let args = ['-C', tree] + args
endif