From 1b811b88a45ff7b906ea9314adf016883ce5cd9e Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 20 Apr 2022 13:48:36 -0400 Subject: [PATCH] Avoid IO from ":p" during detection --- plugin/fugitive.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 2ec473f..ed5c959 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -413,9 +413,10 @@ function! FugitiveExtractGitDir(path) abort return matchstr(path, '\C^fugitive:\%(//\)\=\zs.\{-\}\ze\%(//\|::\|$\)') elseif empty(path) return '' - else - let path = fnamemodify(path, ':p:h') + elseif path !~# '^/\|^\a\+:' + let path = s:Slash(getcwd()) . '/' . path endif + let path = fnamemodify(path, ':h') let pre = substitute(matchstr(path, '^\a\a\+\ze:'), '^.', '\u&', '') if len(pre) && exists('*' . pre . 'Real') let path ={pre}Real(path)