From b7e57637ba8e6cb784dbe32b25acf17d44542871 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 21 Jul 2018 16:52:06 -0400 Subject: [PATCH] Add warning for editing invalid Fugitive URL Closes https://github.com/tpope/vim-fugitive/issues/1060 --- autoload/fugitive.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d37f932..0802adf 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -2841,6 +2841,9 @@ function! fugitive#BufReadCmd(...) abort let amatch = a:0 ? a:1 : expand('') try 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] if v:shell_error unlet b:fugitive_type