diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 9977549..82c8723 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -85,6 +85,10 @@ func! s:bundle.nosync() return has_key(self, 'sync') && 'no' == self.sync() endf +func! s:bundle.installed() + return !empty(split(globpath(self.path(), '*'), "\n")) +endf + func! s:bundle.path() if self.nosync() if isdirectory(expand(self.uri)) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index e909fe3..d1ffdd3 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -61,10 +61,14 @@ func! s:helptags(rtp) abort helptags `=a:rtp.'/doc/'` endf + +func! s:installed(bundle) abort + return !empty(split(globpath(a:bundle.path(), '*'), "\n")) +endf + func! s:sync(bang, bundle) abort if a:bundle.nosync() | return 0 | endif - let git_dir = expand(a:bundle.path().'/.git') - if isdirectory(git_dir) + if a:bundle.installed() if !(a:bang) | return 0 | endif let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' else