commit ca03f1d0699a8fc62ac162eefbf5b5c05cf38cd7 (tree)
parent ae6f84adf3240e007f2be077d103781f65d4a437
Author: Tim Pope <code@tpope.net>
Date: Sun, 4 Jul 2021 08:14:06 -0400
Fix write in index with guioptions=!
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -2258,6 +2258,10 @@ function! fugitive#FileWriteCmd(...) abort
if commit !~# '^[0-3]$' || !v:cmdbang && (line("'[") != 1 || line("']") != line('$'))
return "noautocmd '[,']write" . (v:cmdbang ? '!' : '') . ' ' . s:fnameescape(amatch)
endif
+ if exists('+guioptions') && &guioptions =~# '!'
+ let guioptions = &guioptions
+ set guioptions-=!
+ endif
silent execute "'[,']write !".fugitive#Prepare(dir, 'hash-object', '-w', '--stdin', '--').' > '.tmp
let sha1 = readfile(tmp)[0]
let old_mode = matchstr(s:SystemError([dir, 'ls-files', '--stage', '.' . file])[0], '^\d\+')
@@ -2275,6 +2279,9 @@ function! fugitive#FileWriteCmd(...) abort
return 'echoerr '.string('fugitive: '.error)
endif
finally
+ if exists('guioptions')
+ let &guioptions = guioptions
+ endif
call delete(tmp)
endtry
endfunction