From 2064312ad7bb80050baf9acbdfb7641162919e53 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Wed, 1 Dec 2021 19:58:06 -0500 Subject: [PATCH] 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 --- autoload/fugitive.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index bcd512c..56badb5 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -478,9 +478,7 @@ function! fugitive#CommonDir(dir) abort return '' endif if !has_key(s:commondirs, a:dir) - if getfsize(a:dir . '/HEAD') < 10 - let s:commondirs[a:dir] = '' - elseif filereadable(a:dir . '/commondir') + if filereadable(a:dir . '/commondir') && getfsize(a:dir . '/HEAD') >= 10 let cdir = get(readfile(a:dir . '/commondir', '', 1), 0, '') if cdir =~# '^/\|^\a:/' let s:commondirs[a:dir] = s:Slash(FugitiveVimPath(cdir))