diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index bc807c3f..c022386a 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -174,7 +174,7 @@ func! vundle#installer#delete(bang, dir_name) abort \ 'rm -rf' let bundle = vundle#config#init_bundle(a:dir_name, {}) - let cmd .= ' '.shellescape(bundle.path()) + let cmd .= ' '.vundle#installer#shellesc(bundle.path()) let out = s:system(cmd) @@ -214,15 +214,15 @@ func! s:sync(bang, bundle) abort let git_dir = expand(a:bundle.path().'/.git/', 1) if isdirectory(git_dir) || filereadable(expand(a:bundle.path().'/.git', 1)) if !(a:bang) | return 'todate' | endif - let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull && git submodule update --init --recursive' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git pull && git submodule update --init --recursive' let cmd = g:shellesc_cd(cmd) - let get_current_sha = 'cd '.shellescape(a:bundle.path()).' && git rev-parse HEAD' + let get_current_sha = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' let get_current_sha = g:shellesc_cd(get_current_sha) let initial_sha = s:system(get_current_sha)[0:15] else - let cmd = 'git clone --recursive '.shellescape(a:bundle.uri).' '.shellescape(a:bundle.path()) + let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) let initial_sha = '' endif @@ -250,19 +250,18 @@ func! s:sync(bang, bundle) abort return 'updated' endf -func! g:shellesc(cmd) abort +func! vundle#installer#shellesc(cmd) abort if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) - if &shellxquote != '(' " workaround for patch #445 + if &shellxquote != '(' " workaround for patch #445 return '"'.a:cmd.'"' " enclose in quotes so && joined cmds work endif endif - return a:cmd + return shellescape(a:cmd) endf func! g:shellesc_cd(cmd) abort if ((has('win32') || has('win64')) && empty(matchstr(&shell, 'sh'))) let cmd = substitute(a:cmd, '^cd ','cd /d ','') " add /d switch to change drives - let cmd = g:shellesc(cmd) return cmd else return a:cmd diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index ded6a46a..0cd4d139 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -39,7 +39,7 @@ func! s:create_changelog() abort let updated_sha = bundle_data[1] let bundle = bundle_data[2] - let cmd = 'cd '.shellescape(bundle.path()). + let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). \ ' && git log --pretty=format:"%s %an, %ar" --graph '. \ initial_sha.'..'.updated_sha @@ -155,13 +155,13 @@ func! s:fetch_scripts(to) let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' if executable("curl") - let cmd = 'curl --fail -s -o '.shellescape(a:to).' '.l:vim_scripts_json + let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json elseif executable("wget") - let temp = shellescape(tempname()) - let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.shellescape(a:to) + let temp = vundle#installer#shellesc(tempname()) + let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) if (has('win32') || has('win64')) let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag - let cmd = g:shellesc(cmd) + let cmd = vundle#installer#shellesc(cmd) end else echoerr 'Error curl or wget is not available!' diff --git a/test/vimrc b/test/vimrc index 662709ff..45e4d802 100644 --- a/test/vimrc +++ b/test/vimrc @@ -4,28 +4,27 @@ set nocompatible set nowrap let root = '/tmp/!vundle-test/bundles/' -let src = 'http://github.com/gmarik/vundle.git' +" let src = 'http://github.com/gmarik/vundle.git' " let src = '~/.vim/bundle/vundle/.git' " Vundle Options " let g:vundle_default_git_proto = 'git' -if !isdirectory(expand(root, 1).'/vundle') - exec '!git clone '.src.' '.shellescape(root, 1).'/vundle' -endif +" if !isdirectory(expand(root, 1).'/vundle') +" exec '!git clone '.src.' '.shellescape(root, 1).'/vundle' +" endif filetype off syntax on runtime macros/matchit.vim -exec 'set rtp+='.root.'/vundle' +" This test should be executed in "test" directory +set rtp+=.. call vundle#rc(root) -Bundle "gmarik/vundle" - " vim-scripts name Bundle 'molokai'