Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probe thinks my repo_root is my home directory #9

Closed
campbellr opened this issue Dec 15, 2015 · 2 comments
Closed

Probe thinks my repo_root is my home directory #9

campbellr opened this issue Dec 15, 2015 · 2 comments

Comments

@campbellr
Copy link
Contributor

When I run :Probe outside of a vcs repository (but under my home directory) it ends up scanning everything under ~/ instead of just under my current working directory (like i would have expected).

After some digging, it looks like this is because I have file (/home/ryan/.bzr.log) that is accidentally getting matched against metadir_pattern ( \v/\.(git|hg|svn|bzr)>).

If i understand vim patterns (which i don't), > matches the end of a word, which doesn't include periods

I made the following change that seems to work:

diff --git a/autoload/probe/file.vim b/autoload/probe/file.vim
index 5c43a7e..e6aeba8 100644
--- a/autoload/probe/file.vim
+++ b/autoload/probe/file.vim
@@ -138,7 +138,7 @@ function! s:cache_filepath()
 endfunction

 function! s:find_metadir()
-    let metadir_pattern = '\v/\.(git|hg|svn|bzr)>'
+    let metadir_pattern = '\v/\.(git|hg|svn|bzr)\n'
     let orig_dir = getcwd()
     let dir = orig_dir
     while 1

I'd submit this as a pull request if i was more confident that this change doesn't break something else...

@torbiak
Copy link
Owner

torbiak commented Dec 15, 2015

It used to look for \n, actually, before 74d5305. I have no idea why I changed it, since glob() and globpath() explicitly return a string of paths separated by newlines.

torbiak added a commit that referenced this issue Dec 15, 2015
torbiak added a commit that referenced this issue Dec 15, 2015
globpath() returns a newline-separated string of paths, so it isn't
clear why a word boundary was being searched for.

fixes #9
@campbellr
Copy link
Contributor Author

Cool, thanks!

campbellr added a commit to campbellr/probe that referenced this issue May 13, 2016
In the fix for torbiak#9, `metadir_pattern` was changed to include a newline, but
that newline was never stripped off before returning it.

So instead of `s:find_metadir` returning something like `path/to/.git`, it
returned `path/to/.git\n` which broke the check in `s:branch`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants