Better error on :Gwrite failure

References https://github.com/tpope/vim-fugitive/issues/696
This commit is contained in:
Tim Pope 2015-10-06 20:33:41 -04:00
parent 0b43b51d77
commit 1e755064e9

View File

@ -1461,6 +1461,9 @@ function! s:Write(force,...) abort
let mytab = tabpagenr()
let mybufnr = bufnr('')
let path = a:0 ? join(a:000, ' ') : s:buffer().path()
if empty(path)
return 'echoerr '.string('fugitive: cannot determine file path')
endif
if path =~# '^:\d\>'
return 'write'.(a:force ? '! ' : ' ').s:fnameescape(s:repo().translate(s:buffer().expand(path)))
endif