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