Remove 'guioptions' workaround

This commit is contained in:
Tim Pope 2019-08-09 00:44:04 -04:00
parent 8227503714
commit bc3d36e559

View File

@ -3246,41 +3246,33 @@ function! s:CommitSubcommand(line1, line2, range, bang, mods, args, ...) abort
let msgfile = fugitive#Find('.git/COMMIT_EDITMSG', dir)
let outfile = tempname()
try
let guioptions = &guioptions
try
if &guioptions =~# '!'
setglobal guioptions-=!
endif
if s:winshell()
let command = 'set GIT_EDITOR=false& '
if s:winshell()
let command = 'set GIT_EDITOR=false& '
else
let command = 'env GIT_EDITOR=false '
endif
let argv = a:args
let i = 0
while get(argv, i, '--') !=# '--'
if argv[i] =~# '^-[apzsneiovq].'
call insert(argv, argv[i][0:1])
let argv[i+1] = '-' . argv[i+1][2:-1]
else
let command = 'env GIT_EDITOR=false '
let i += 1
endif
let argv = a:args
let i = 0
while get(argv, i, '--') !=# '--'
if argv[i] =~# '^-[apzsneiovq].'
call insert(argv, argv[i][0:1])
let argv[i+1] = '-' . argv[i+1][2:-1]
else
let i += 1
endif
endwhile
let command .= s:UserCommand(dir) . ' commit ' . s:shellesc(argv)
if (&autowrite || &autowriteall) && !a:0
silent! wall
endif
if s:HasOpt(argv, '-i', '--interactive')
return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0)
elseif s:HasOpt(argv, '-p', '--patch')
return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1)
else
let [error_string, exec_error] = s:TempCmd(outfile, command)
let errors = split(error_string, "\n")
endif
finally
let &guioptions = guioptions
endtry
endwhile
let command .= s:UserCommand(dir) . ' commit ' . s:shellesc(argv)
if (&autowrite || &autowriteall) && !a:0
silent! wall
endif
if s:HasOpt(argv, '-i', '--interactive')
return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 0)
elseif s:HasOpt(argv, '-p', '--patch')
return s:CommitInteractive(a:line1, a:line2, a:range, a:bang, a:mods, argv, 1)
else
let [error_string, exec_error] = s:TempCmd(outfile, command)
let errors = split(error_string, "\n")
endif
if !has('gui_running')
redraw!
endif