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.
This commit is contained in:
parent
3026076ab5
commit
4b69204679
@ -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$','')
|
||||
|
Loading…
Reference in New Issue
Block a user