Don't detect incorrect root on fake paths

For example, fugitive buffers were getting detected using the current
working directory.
This commit is contained in:
Tim Pope 2012-12-09 14:12:57 -05:00
parent cb1ebfbc5b
commit 9552ad6e23
2 changed files with 5 additions and 2 deletions

View File

@ -54,7 +54,7 @@ function! classpath#detect(...) abort
let root = simplify(fnamemodify(bufname(buffer), ':p:s?[\/]$??'))
endif
if root =~# '^zipfile:'
if !isdirectory(fnamemodify(root, ':h'))
return default
endif

View File

@ -848,6 +848,9 @@ augroup END
function! s:hunt(start, anchor) abort
let root = simplify(fnamemodify(a:start, ':p:s?[\/]$??'))
if !isdirectory(fnamemodify(root, ':p'))
return ''
endif
let previous = ""
while root !=# previous
if filereadable(root . '/' . a:anchor) && isdirectory(root . '/src')