From ebc3f3557506de57a13fa9bad77171cd7e1b2b91 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Fri, 26 Jul 2019 11:21:29 -0400 Subject: [PATCH] Require bang to :Gwrite from index Closes https://github.com/tpope/vim-fugitive/issues/1057 --- autoload/fugitive.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 2b22cf5..463451d 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -3813,7 +3813,7 @@ function! s:WriteCommand(line1, line2, range, count, bang, mods, reg, arg, args) if file =~# '^fugitive:' return 'write' . (a:bang ? '! ' : ' ') . s:fnameescape(file) endif - let always_permitted = s:cpath(fugitive#Real(@%), file) && s:DirCommitFile(@%)[1] =~# '^0\=$' + let always_permitted = s:cpath(fugitive#Real(@%), file) && empty(s:DirCommitFile(@%)[1]) if !always_permitted && !a:bang && (len(s:TreeChomp('diff', '--name-status', 'HEAD', '--', file)) || len(s:TreeChomp('ls-files', '--others', '--', file))) let v:errmsg = 'fugitive: file has uncommitted changes (use ! to override)' return 'echoerr v:errmsg'