commit ebc3f3557506de57a13fa9bad77171cd7e1b2b91 (tree)
parent 79566b5ddd40eab97c47e6495aa2107a62b7bdf0
Author: Tim Pope <code@tpope.net>
Date: Fri, 26 Jul 2019 11:21:29 -0400
Require bang to :Gwrite from index
Closes https://github.com/tpope/vim-fugitive/issues/1057
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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'