From 9552ad6e23b3960306848e964e6864a2737678d9 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sun, 9 Dec 2012 14:12:57 -0500 Subject: [PATCH] Don't detect incorrect root on fake paths For example, fugitive buffers were getting detected using the current working directory. --- autoload/classpath.vim | 2 +- plugin/foreplay.vim | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/autoload/classpath.vim b/autoload/classpath.vim index e60e67b..fa3f9a9 100644 --- a/autoload/classpath.vim +++ b/autoload/classpath.vim @@ -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 diff --git a/plugin/foreplay.vim b/plugin/foreplay.vim index afcf0dc..7e1cc89 100644 --- a/plugin/foreplay.vim +++ b/plugin/foreplay.vim @@ -848,9 +848,12 @@ 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') + if filereadable(root . '/' . a:anchor) && isdirectory(root . '/src') return root endif let previous = root