Only do "guessed" :Gwrite behaviors with no argument

These seem pretty silly these days and should probably be removed, but
let's start by reducing their scope.
This commit is contained in:
Tim Pope
2021-04-15 10:02:19 -04:00
parent 8686eb17e0
commit f72ad60097

View File

@@ -5058,9 +5058,9 @@ endfunction
" Section: :Gwrite, :Gwq
function! fugitive#WriteCommand(line1, line2, range, bang, mods, arg, args) abort
if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG'))
if s:cpath(expand('%:p'), fugitive#Find('.git/COMMIT_EDITMSG')) && empty(a:arg)
return (empty($GIT_INDEX_FILE) ? 'write|bdelete' : 'wq') . (a:bang ? '!' : '')
elseif get(b:, 'fugitive_type', '') ==# 'index'
elseif get(b:, 'fugitive_type', '') ==# 'index' && empty(a:arg)
return 'Git commit'
elseif &buftype ==# 'nowrite' && getline(4) =~# '^[+-]\{3\} '
return 'echoerr ' . string('fugitive: :Gwrite from :Git diff has been removed in favor of :Git add --edit')