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 errorfile = tempname()
try
execute cd.'`=s:repo().tree()`'
if &shell =~# 'cmd'
let command = ''
let old_editor = $GIT_EDITOR
let $GIT_EDITOR = 'false'
else
let command = 'env GIT_EDITOR=false '
endif
let command .= s:repo().git_command('commit').' '.a:args
if &shell =~# 'csh'
silent execute '!('.command.' > '.outfile.') >& '.errorfile
elseif a:args =~# '\%(^\| \)--interactive\>'
execute '!'.command.' 2> '.errorfile
else
silent execute '!'.command.' > '.outfile.' 2> '.errorfile
endif
try
execute cd.s:fnameescape(s:repo().tree())
if &shell =~# 'cmd'
let command = ''
let old_editor = $GIT_EDITOR
let $GIT_EDITOR = 'false'
else
let command = 'env GIT_EDITOR=false '
endif
let command .= s:repo().git_command('commit').' '.a:args
if &shell =~# 'csh'
silent execute '!('.command.' > '.outfile.') >& '.errorfile
elseif a:args =~# '\%(^\| \)--interactive\>'
execute '!'.command.' 2> '.errorfile
else
silent execute '!'.command.' > '.outfile.' 2> '.errorfile
endif
finally
execute cd.'`=dir`'
endtry
if !has('gui_running')
redraw!
endif
@ -827,7 +831,7 @@ function! s:Commit(args) abort
execute 'keepalt split '.s:fnameescape(msgfile)
endif
let b:fugitive_commit_arguments = args
setlocal bufhidden=delete filetype=gitcommit
setlocal bufhidden=wipe filetype=gitcommit
return '1'
elseif error ==# '!'
return s:Status()
@ -843,7 +847,6 @@ function! s:Commit(args) abort
endif
call delete(outfile)
call delete(errorfile)
execute cd.'`=dir`'
call fugitive#reload_status()
endtry
endfunction