From 4b69204679a9a55c31493dd63bdf6941015ea196 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 29 Mar 2011 19:48:40 +0200 Subject: [PATCH] Handle non-readable .git dirs. This can happen when a normal user edits/views some files in /etc, which is maintained using git/etckeeper, and /etc/.git is only readable by root. --- plugin/fugitive.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 970d158..dafe109 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -108,7 +108,7 @@ function! s:ExtractGitDir(path) abort let ofn = "" let nfn = fn while fn != ofn - if isdirectory(fn . '/.git') + if filereadable(fn . '/.git/HEAD') return s:sub(simplify(fnamemodify(fn . '/.git',':p')),'\W$','') elseif fn =~ '\.git$' && filereadable(fn . '/HEAD') return s:sub(simplify(fnamemodify(fn,':p')),'\W$','')