From 2b194760dd89562b75eb67c73ee84ed9a982e17c Mon Sep 17 00:00:00 2001 From: cameris Date: Sat, 2 Jan 2016 16:49:01 +0100 Subject: [PATCH 1/2] Added variables for git, curl & wget executables, making it easier to use Vundle with gVimPortable and PortableGit. --- autoload/vundle.vim | 10 ++++++++++ autoload/vundle/installer.vim | 20 +++++++++++--------- autoload/vundle/scripts.vim | 10 +++++----- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 148ff3ef..f05d74b6 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -87,4 +87,14 @@ let vundle#lazy_load = 0 let vundle#log = [] let vundle#updated_bundles = [] +if !exists('g:vundle#git_executable') + let vundle#git_executable = 'git' +endf +if !exists('g:vundle#curl_executable') + let vundle#curl_executable = 'curl' +endf +if !exists('g:vundle#wget_executable') + let vundle#wget_executable = 'wget' +endf + " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 472271a3..5ade369d 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -343,7 +343,8 @@ endf " return -- the URL for the origin remote (string) " --------------------------------------------------------------------------- func! s:get_current_origin_url(bundle) abort - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' config --get remote.origin.url' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:strip(s:system(cmd)) return out @@ -357,7 +358,8 @@ endf " return -- A 15 character log sha for the current HEAD " --------------------------------------------------------------------------- func! s:get_current_sha(bundle) - let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD' + let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && '. + g:vundle#git_executable.' rev-parse HEAD' let cmd = vundle#installer#shellesc_cd(cmd) let out = s:system(cmd)[0:15] return out @@ -389,10 +391,10 @@ func! s:make_sync_command(bang, bundle) abort " Directory names match but the origin remotes are not the same let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()) , - \ 'git remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), - \ 'git fetch', - \ 'git reset --hard origin/HEAD', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' remote set-url origin ' . vundle#installer#shellesc(a:bundle.uri), + \ g:vundle#git_executable.' fetch', + \ g:vundle#git_executable.' reset --hard origin/HEAD', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) @@ -407,15 +409,15 @@ func! s:make_sync_command(bang, bundle) abort let cmd_parts = [ \ 'cd '.vundle#installer#shellesc(a:bundle.path()), - \ 'git pull', - \ 'git submodule update --init --recursive', + \ g:vundle#git_executable.' pull', + \ g:vundle#git_executable.' submodule update --init --recursive', \ ] let cmd = join(cmd_parts, ' && ') let cmd = vundle#installer#shellesc_cd(cmd) let initial_sha = s:get_current_sha(a:bundle) else - let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) + let cmd = g:vundle#git_executable.' clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()) let initial_sha = '' endif return [cmd, initial_sha] diff --git a/autoload/vundle/scripts.vim b/autoload/vundle/scripts.vim index f789762f..e34b555a 100644 --- a/autoload/vundle/scripts.vim +++ b/autoload/vundle/scripts.vim @@ -84,7 +84,7 @@ func! s:create_changelog() abort let bundle = bundle_data[2] let cmd = 'cd '.vundle#installer#shellesc(bundle.path()). - \ ' && git log --pretty=format:"%s %an, %ar" --graph '. + \ ' && '.g:vundle#git_executable.' log --pretty=format:"%s %an, %ar" --graph '. \ initial_sha.'..'.updated_sha let cmd = vundle#installer#shellesc_cd(cmd) @@ -235,11 +235,11 @@ func! s:fetch_scripts(to) endif let l:vim_scripts_json = 'http://vim-scripts.org/api/scripts.json' - if executable("curl") - let cmd = 'curl --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json - elseif executable("wget") + if executable(g:vundle#curl_executable) + let cmd = g:vundle#curl_executable.' --fail -s -o '.vundle#installer#shellesc(a:to).' '.l:vim_scripts_json + elseif executable(g:vundle#wget_executable) let temp = vundle#installer#shellesc(tempname()) - let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.vundle#installer#shellesc(a:to) + let cmd = g:vundle#wget_executable.' -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 = vundle#installer#shellesc(cmd) From 651a47f80d7c141d33085f9c2f4d9fcf2c0fa157 Mon Sep 17 00:00:00 2001 From: cameris Date: Tue, 19 Jan 2016 00:19:18 +0100 Subject: [PATCH 2/2] Corrected endif typo --- autoload/vundle.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index f05d74b6..a1613668 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -89,12 +89,12 @@ let vundle#updated_bundles = [] if !exists('g:vundle#git_executable') let vundle#git_executable = 'git' -endf +endif if !exists('g:vundle#curl_executable') let vundle#curl_executable = 'curl' -endf +endif if !exists('g:vundle#wget_executable') let vundle#wget_executable = 'wget' -endf +endif " vim: set expandtab sts=2 ts=2 sw=2 tw=78 norl: