parent
dcd79f2adb
commit
903ad4d704
@ -773,13 +773,10 @@ endfunction
|
|||||||
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
|
call s:command("-nargs=? -complete=customlist,s:CommitComplete Gcommit :execute s:Commit(<q-args>)")
|
||||||
|
|
||||||
function! s:Commit(args) abort
|
function! s:Commit(args) abort
|
||||||
let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
|
|
||||||
let dir = getcwd()
|
|
||||||
let msgfile = s:repo().dir('COMMIT_EDITMSG')
|
let msgfile = s:repo().dir('COMMIT_EDITMSG')
|
||||||
let outfile = tempname()
|
let outfile = tempname()
|
||||||
let errorfile = tempname()
|
let errorfile = tempname()
|
||||||
try
|
try
|
||||||
execute cd.'`=s:repo().tree()`'
|
|
||||||
if &shell =~# 'cmd'
|
if &shell =~# 'cmd'
|
||||||
let command = ''
|
let command = ''
|
||||||
let old_editor = $GIT_EDITOR
|
let old_editor = $GIT_EDITOR
|
||||||
@ -787,7 +784,7 @@ function! s:Commit(args) abort
|
|||||||
else
|
else
|
||||||
let command = 'env GIT_EDITOR=false '
|
let command = 'env GIT_EDITOR=false '
|
||||||
endif
|
endif
|
||||||
let command .= s:repo().git_command('commit').' '.a:args
|
let command .= s:sub(s:repo().git_command('commit'),'--git-dir','--work-tree='.s:shellesc(s:repo().tree()).' --git-dir').' '.a:args
|
||||||
if &shell =~# 'csh'
|
if &shell =~# 'csh'
|
||||||
silent execute '!('.command.' > '.outfile.') >& '.errorfile
|
silent execute '!('.command.' > '.outfile.') >& '.errorfile
|
||||||
elseif a:args =~# '\%(^\| \)--interactive\>'
|
elseif a:args =~# '\%(^\| \)--interactive\>'
|
||||||
@ -843,7 +840,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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user