Add warning for editing invalid Fugitive URL

Closes https://github.com/tpope/vim-fugitive/issues/1060
This commit is contained in:
Tim Pope 2018-07-21 16:52:06 -04:00
parent 35f94eef48
commit b7e57637ba

View File

@ -2841,6 +2841,9 @@ function! fugitive#BufReadCmd(...) abort
let amatch = a:0 ? a:1 : expand('<amatch>') let amatch = a:0 ? a:1 : expand('<amatch>')
try try
let [dir, rev] = s:DirRev(amatch) let [dir, rev] = s:DirRev(amatch)
if empty(dir)
return 'echo "Invalid Fugitive URL"'
endif
let b:fugitive_type = system(fugitive#Prepare(dir, 'cat-file', '-t', rev))[0:-2] let b:fugitive_type = system(fugitive#Prepare(dir, 'cat-file', '-t', rev))[0:-2]
if v:shell_error if v:shell_error
unlet b:fugitive_type unlet b:fugitive_type