mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-16 07:13:52 -05:00
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:
@@ -108,7 +108,7 @@ function! s:ExtractGitDir(path) abort
|
|||||||
let ofn = ""
|
let ofn = ""
|
||||||
let nfn = fn
|
let nfn = fn
|
||||||
while fn != ofn
|
while fn != ofn
|
||||||
if isdirectory(fn . '/.git')
|
if filereadable(fn . '/.git/HEAD')
|
||||||
return s:sub(simplify(fnamemodify(fn . '/.git',':p')),'\W$','')
|
return s:sub(simplify(fnamemodify(fn . '/.git',':p')),'\W$','')
|
||||||
elseif fn =~ '\.git$' && filereadable(fn . '/HEAD')
|
elseif fn =~ '\.git$' && filereadable(fn . '/HEAD')
|
||||||
return s:sub(simplify(fnamemodify(fn,':p')),'\W$','')
|
return s:sub(simplify(fnamemodify(fn,':p')),'\W$','')
|
||||||
|
|||||||
Reference in New Issue
Block a user