From 2b6199594a6378351e6aab92b35b14f5b7e8a812 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Mon, 19 Aug 2019 09:01:05 -0400 Subject: [PATCH] Use FugitiveVimPath() to normalize directories during detection --- autoload/fugitive.vim | 8 ++++---- plugin/fugitive.vim | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index b06b1d5..d37949c 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -275,11 +275,11 @@ function! fugitive#CommonDir(dir) abort if getfsize(a:dir . '/HEAD') < 10 let s:commondirs[a:dir] = '' elseif filereadable(a:dir . '/commondir') - let dir = get(readfile(a:dir . '/commondir', 1), 0, '') - if dir =~# '^/\|^\a:/' - let s:commondirs[a:dir] = dir + let cdir = get(readfile(a:dir . '/commondir', 1), 0, '') + if cdir =~# '^/\|^\a:/' + let s:commondirs[a:dir] = s:Slash(FugitiveVimPath(cdir)) else - let s:commondirs[a:dir] = simplify(a:dir . '/' . dir) + let s:commondirs[a:dir] = simplify(a:dir . '/' . cdir) endif else let s:commondirs[a:dir] = a:dir diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index 59c792c..4070f54 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -124,10 +124,10 @@ function! s:Tree(path) abort let config = readfile(config_file,'',10) call filter(config,'v:val =~# "^\\s*worktree *="') if len(config) == 1 - let worktree = matchstr(config[0], '= *\zs.*') + let worktree = s:Slash(FugitiveVimPath(matchstr(config[0], '= *\zs.*'))) endif elseif filereadable(dir . '/gitdir') - let worktree = fnamemodify(readfile(dir . '/gitdir')[0], ':h') + let worktree = s:Slash(fnamemodify(FugitiveVimPath(readfile(dir . '/gitdir')[0]), ':h')) if worktree ==# '.' unlet! worktree endif @@ -162,7 +162,7 @@ function! FugitiveExtractGitDir(path) abort silent! exe (haslocaldir() ? 'lcd' : exists(':tcd') && haslocaldir(-1) ? 'tcd' : 'cd') '.' endif let previous = "" - let env_git_dir = len($GIT_DIR) ? s:Slash(simplify(fnamemodify($GIT_DIR, ':p:s?[\/]$??'))) : '' + let env_git_dir = len($GIT_DIR) ? s:Slash(simplify(fnamemodify(FugitiveVimPath($GIT_DIR), ':p:s?[\/]$??'))) : '' call s:Tree(env_git_dir) while root !=# previous if root =~# '\v^//%([^/]+/?)?$' @@ -184,7 +184,7 @@ function! FugitiveExtractGitDir(path) abort return resolve(dir) elseif type !=# '' && filereadable(dir) let line = get(readfile(dir, '', 1), 0, '') - let file_dir = matchstr(line, '^gitdir: \zs.*') + let file_dir = s:Slash(FugitiveVimPath(matchstr(line, '^gitdir: \zs.*'))) if file_dir !~# '^/\|^\a:' && FugitiveIsGitDir(root . '/' . file_dir) return simplify(root . '/' . file_dir) elseif len(file_dir) && FugitiveIsGitDir(file_dir)