Hack around broken :Gcommit with symlinked .git

This commit is contained in:
Tim Pope 2012-03-03 03:22:48 -05:00
parent da2aebe3e6
commit 22c8ffa2ba

View File

@ -779,7 +779,8 @@ function! s:Commit(args) abort
let outfile = tempname() let outfile = tempname()
let errorfile = tempname() let errorfile = tempname()
try try
execute cd.'`=s:repo().tree()`' try
execute cd.s:fnameescape(s:repo().tree())
if &shell =~# 'cmd' if &shell =~# 'cmd'
let command = '' let command = ''
let old_editor = $GIT_EDITOR let old_editor = $GIT_EDITOR
@ -795,6 +796,9 @@ function! s:Commit(args) abort
else else
silent execute '!'.command.' > '.outfile.' 2> '.errorfile silent execute '!'.command.' > '.outfile.' 2> '.errorfile
endif endif
finally
execute cd.'`=dir`'
endtry
if !has('gui_running') if !has('gui_running')
redraw! redraw!
endif endif
@ -827,7 +831,7 @@ function! s:Commit(args) abort
execute 'keepalt split '.s:fnameescape(msgfile) execute 'keepalt split '.s:fnameescape(msgfile)
endif endif
let b:fugitive_commit_arguments = args let b:fugitive_commit_arguments = args
setlocal bufhidden=delete filetype=gitcommit setlocal bufhidden=wipe filetype=gitcommit
return '1' return '1'
elseif error ==# '!' elseif error ==# '!'
return s:Status() return s:Status()
@ -843,7 +847,6 @@ function! s:Commit(args) abort
endif endif
call delete(outfile) call delete(outfile)
call delete(errorfile) call delete(errorfile)
execute cd.'`=dir`'
call fugitive#reload_status() call fugitive#reload_status()
endtry endtry
endfunction endfunction