Fix s:Cd() usage in the Gblame command

Most usages in commit da3b2f32 (Support tab local working directories)
were updated to use this pattern, but Gblame missed the boat. Without
this, Gblame will change the root git tree but won't change back to the
previous location.
This commit is contained in:
John Drouhard 2019-01-23 13:42:51 -06:00 committed by Tim Pope
parent 8b32524219
commit 50cf1b3bd1

View File

@ -3549,13 +3549,7 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort
let cmd += ['--', expand('%:p')]
let basecmd = escape(fugitive#Prepare(cmd), '!#%')
try
let cd = s:Cd()
let tree = s:Tree()
let cdback = s:Cd(tree)
if len(tree) && s:cpath(tree) !=# s:cpath(getcwd())
let cwd = getcwd()
execute cd s:fnameescape(tree)
endif
let cdback = s:Cd(s:Tree())
let error = tempname()
let temp = error.'.fugitiveblame'
if &shell =~# 'csh'
@ -3563,10 +3557,10 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort
else
silent! execute '%write !'.basecmd.' > '.temp.' 2> '.error
endif
if exists('l:cwd')
execute cd s:fnameescape(cwd)
unlet cwd
endif
finally
execute cdback
endtry
try
if v:shell_error
call s:throw(join(readfile(error),"\n"))
endif
@ -3639,10 +3633,6 @@ function! s:Blame(bang, line1, line2, count, mods, args) abort
redraw
syncbind
endif
finally
if exists('l:cwd')
execute cd s:fnameescape(cwd)
endif
endtry
return ''
catch /^fugitive:/