From 343508e9fd981928f1e830c71c9d8b2a54edb7dd Mon Sep 17 00:00:00 2001 From: Eugenij <62702485+Eugenij-W@users.noreply.github.com> Date: Fri, 27 Mar 2020 02:33:11 +0600 Subject: [PATCH] Fix infinity loop in FindParentVCSRoot (#1095) * Fix infinity loop in FindParentVCSRoot (on windows os with 'set shellslash' in vimrc and no VCS in path) * update CHANGELOG.md * Update CHANGELOG.md Co-Authored-By: Phil Runninger Co-authored-by: evgenij.vidershpan Co-authored-by: Phil Runninger --- CHANGELOG.md | 1 + nerdtree_plugin/vcs.vim | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b86e8..e318315 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> #### 6.7 +- **.2**: Fix infinity loop (on winvim) in FindParentVCSRoot (Eugenij-W) [#1095](https://github.com/preservim/nerdtree/pull/1095) - **.1**: File Move: Escape existing directory name when looking for open files. (PhilRunninger) [#1094](https://github.com/preservim/nerdtree/pull/1094) - **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090) #### 6.6 diff --git a/nerdtree_plugin/vcs.vim b/nerdtree_plugin/vcs.vim index 36d5427..d20e35e 100644 --- a/nerdtree_plugin/vcs.vim +++ b/nerdtree_plugin/vcs.vim @@ -34,7 +34,7 @@ endfunction function! s:FindParentVCSRoot(path) let l:path = a:path while !empty(l:path) && - \ l:path._str() !~# '^\(\a:\\\|\/\)$' && + \ l:path._str() !~# '^\(\a:[\\\/]\|\/\)$' && \ !isdirectory(l:path._str() . '/.git') && \ !isdirectory(l:path._str() . '/.svn') && \ !isdirectory(l:path._str() . '/.hg') && @@ -42,6 +42,6 @@ function! s:FindParentVCSRoot(path) \ !isdirectory(l:path._str() . '/_darcs') let l:path = l:path.getParent() endwhile - return (empty(l:path) || l:path._str() =~# '^\(\a:\\\|\/\)$') ? a:path : l:path + return (empty(l:path) || l:path._str() =~# '^\(\a:[\\\/]\|\/\)$') ? a:path : l:path endfunction