diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index d78e470..2b5fdd2 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -511,7 +511,7 @@ function! fugitive#Real(url) abort let tree = FugitiveTreeForGitDir(dir) return s:PlatformSlash((len(tree) ? tree : dir) . file) endif - let url = fnamemodify(a:url, ':p' . (a:url =~# '[\/]$' ? '' : ':s?[\/]$??')) + let url = len(url) ? fnamemodify(a:url, ':p' . (a:url =~# '[\/]$' ? '' : ':s?[\/]$??')) : '' if url =~# '^[\\/]\|^\a:[\\/]' return s:PlatformSlash(url) endif @@ -519,7 +519,7 @@ function! fugitive#Real(url) abort endfunction function! fugitive#Path(url, ...) abort - if !a:0 + if !a:0 || empty(a:url) return fugitive#Real(a:url) endif let url = s:shellslash(fnamemodify(a:url, ':p')) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 0ce9246..99d04e8 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -143,7 +143,7 @@ function! FugitiveReal(...) abort let file = a:0 ? a:1 : @% if file =~? '^fugitive:' || a:0 > 1 return call('fugitive#Real', [file] + a:000[1:-1]) - elseif file =~# '^/\|^\a\+:' + elseif file =~# '^/\|^\a\+:\|^$' return file else return fnamemodify(file, ':p' . (file =~# '[\/]$' ? '' : ':s?[\/]$??'))