mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Don't reject invalid Git dir when detecting common dir
Consumers of this function should be giving us a valid Git dir, and if they don't, returning an empty string will only make matters worse. References: https://github.com/tpope/vim-fugitive/pull/1898
This commit is contained in:
@@ -478,9 +478,7 @@ function! fugitive#CommonDir(dir) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
if !has_key(s:commondirs, a:dir)
|
if !has_key(s:commondirs, a:dir)
|
||||||
if getfsize(a:dir . '/HEAD') < 10
|
if filereadable(a:dir . '/commondir') && getfsize(a:dir . '/HEAD') >= 10
|
||||||
let s:commondirs[a:dir] = ''
|
|
||||||
elseif filereadable(a:dir . '/commondir')
|
|
||||||
let cdir = get(readfile(a:dir . '/commondir', '', 1), 0, '')
|
let cdir = get(readfile(a:dir . '/commondir', '', 1), 0, '')
|
||||||
if cdir =~# '^/\|^\a:/'
|
if cdir =~# '^/\|^\a:/'
|
||||||
let s:commondirs[a:dir] = s:Slash(FugitiveVimPath(cdir))
|
let s:commondirs[a:dir] = s:Slash(FugitiveVimPath(cdir))
|
||||||
|
|||||||
Reference in New Issue
Block a user