motiejus/dotfiles

Unnamed repository; edit this file 'description' to name the repository.
git clone https://git.jakstys.lt/motiejus/dotfiles.git
Log | Tree | Refs | README | LICENSE

commit faa895239bca9192747c43cd9d1bc7ed44627788 (tree)
parent 6eb885c017702b0221f2adf577a87a3dd59ebbdf
Author: Tim Pope <code@tpope.net>
Date:   Thu, 15 Aug 2019 02:21:30 -0400

Clean up gitdir file parsing

Diffstat:
Mplugin/fugitive.vim | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim @@ -184,10 +184,11 @@ function! FugitiveExtractGitDir(path) abort return resolve(dir) elseif type !=# '' && filereadable(dir) let line = get(readfile(dir, '', 1), 0, '') - if line =~# '^gitdir: \.' && FugitiveIsGitDir(root.'/'.line[8:-1]) - return simplify(root.'/'.line[8:-1]) - elseif line =~# '^gitdir: ' && FugitiveIsGitDir(line[8:-1]) - return line[8:-1] + let file_dir = matchstr(line, '^gitdir: \zs.*') + if file_dir !~# '^/\|^\a:' && FugitiveIsGitDir(root . '/' . file_dir) + return simplify(root . '/' . file_dir) + elseif len(file_dir) && FugitiveIsGitDir(file_dir) + return file_dir endif elseif FugitiveIsGitDir(root) return root