Be flexible with path delimiter in detection

This commit is contained in:
Tim Pope 2010-01-13 17:39:54 -05:00
parent 2ed42806b6
commit a792da75c4

View File

@ -88,9 +88,9 @@ function! s:ExtractGitDir(path) abort
let nfn = fn let nfn = fn
while fn != ofn while fn != ofn
if isdirectory(fn . '/.git') if isdirectory(fn . '/.git')
return s:sub(simplify(fnamemodify(fn . '/.git',':p')),'/$','') 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')),'/$','') return s:sub(simplify(fnamemodify(fn,':p')),'\W$','')
endif endif
let ofn = fn let ofn = fn
let fn = fnamemodify(ofn,':h') let fn = fnamemodify(ofn,':h')