Fix write in index with guioptions=!

This commit is contained in:
Tim Pope
2021-07-04 08:14:06 -04:00
parent ae6f84adf3
commit ca03f1d069

View File

@@ -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