Avoid use of :! in :Gcommit
References https://github.com/tpope/vim-fugitive/issues/435
This commit is contained in:
parent
cf9c04af06
commit
3d252dac21
@ -2672,7 +2672,6 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
let tree = s:Tree(dir)
|
let tree = s:Tree(dir)
|
||||||
let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir)
|
let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir)
|
||||||
let outfile = tempname()
|
let outfile = tempname()
|
||||||
let errorfile = tempname()
|
|
||||||
try
|
try
|
||||||
let guioptions = &guioptions
|
let guioptions = &guioptions
|
||||||
try
|
try
|
||||||
@ -2687,12 +2686,13 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
endif
|
endif
|
||||||
let args = s:ShellExpand(a:arg)
|
let args = s:ShellExpand(a:arg)
|
||||||
let command .= s:UserCommand() . ' commit ' . args
|
let command .= s:UserCommand() . ' commit ' . args
|
||||||
if &shell =~# 'csh'
|
if a:arg =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>' && &shell !~# 'csh'
|
||||||
noautocmd silent execute '!('.escape(command, '!#%').' > '.outfile.') >& '.errorfile
|
let errorfile = tempname()
|
||||||
elseif a:arg =~# '\%(^\| \)-\%(-interactive\|p\|-patch\)\>'
|
|
||||||
noautocmd execute '!'.command.' 2> '.errorfile
|
noautocmd execute '!'.command.' 2> '.errorfile
|
||||||
|
let errors = readfile(errorfile)
|
||||||
|
call delete(errorfile)
|
||||||
else
|
else
|
||||||
noautocmd silent execute '!'.command.' > '.outfile.' 2> '.errorfile
|
let errors = split(s:TempCmd(outfile, command), "\n")
|
||||||
endif
|
endif
|
||||||
let error = v:shell_error
|
let error = v:shell_error
|
||||||
finally
|
finally
|
||||||
@ -2711,7 +2711,6 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
call fugitive#ReloadStatus()
|
call fugitive#ReloadStatus()
|
||||||
return ''
|
return ''
|
||||||
else
|
else
|
||||||
let errors = readfile(errorfile)
|
|
||||||
let error = get(errors,-2,get(errors,-1,'!'))
|
let error = get(errors,-2,get(errors,-1,'!'))
|
||||||
if error =~# 'false''\=\.$'
|
if error =~# 'false''\=\.$'
|
||||||
let args = s:gsub(args,'%(%(^| )-- )@<!%(^| )@<=%(-[esp]|--edit|--interactive|--patch|--signoff)%($| )','')
|
let args = s:gsub(args,'%(%(^| )-- )@<!%(^| )@<=%(-[esp]|--edit|--interactive|--patch|--signoff)%($| )','')
|
||||||
@ -2742,7 +2741,6 @@ function! s:CommitCommand(line1, line2, range, count, bang, mods, reg, arg, args
|
|||||||
return 'echoerr ' . string(v:exception)
|
return 'echoerr ' . string(v:exception)
|
||||||
finally
|
finally
|
||||||
call delete(outfile)
|
call delete(outfile)
|
||||||
call delete(errorfile)
|
|
||||||
endtry
|
endtry
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user