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,22 +779,26 @@ 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
if &shell =~# 'cmd' execute cd.s:fnameescape(s:repo().tree())
let command = '' if &shell =~# 'cmd'
let old_editor = $GIT_EDITOR let command = ''
let $GIT_EDITOR = 'false' let old_editor = $GIT_EDITOR
else let $GIT_EDITOR = 'false'
let command = 'env GIT_EDITOR=false ' else
endif let command = 'env GIT_EDITOR=false '
let command .= s:repo().git_command('commit').' '.a:args endif
if &shell =~# 'csh' let command .= s:repo().git_command('commit').' '.a:args
silent execute '!('.command.' > '.outfile.') >& '.errorfile if &shell =~# 'csh'
elseif a:args =~# '\%(^\| \)--interactive\>' silent execute '!('.command.' > '.outfile.') >& '.errorfile
execute '!'.command.' 2> '.errorfile elseif a:args =~# '\%(^\| \)--interactive\>'
else execute '!'.command.' 2> '.errorfile
silent execute '!'.command.' > '.outfile.' 2> '.errorfile else
endif silent execute '!'.command.' > '.outfile.' 2> '.errorfile
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