commit 4b69204679a9a55c31493dd63bdf6941015ea196 (tree)
parent 3026076ab5f60a5a3703d33a933a09d4053c0d95
Author: Daniel Hahler <git@thequod.de>
Date: Tue, 29 Mar 2011 19:48:40 +0200
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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$','')