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

Collected fixes (#509, #575) #589

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 19 additions & 14 deletions autoload/vundle/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
" ---------------------------------------------------------------------------
func! vundle#config#bundle(arg, ...)
let bundle = vundle#config#init_bundle(a:arg, a:000)
if !s:check_bundle_name(bundle)
return
if 'new'!=s:register_bundle_name(bundle)
return {}
endif
if exists('g:vundle#lazy_load') && g:vundle#lazy_load
call add(g:vundle#bundles, bundle)
Expand Down Expand Up @@ -84,25 +84,30 @@ endf


" ---------------------------------------------------------------------------
" Check if the current bundle name has already been used in this running
" instance and show an error to that effect.
" Check if the current bundle name has already been used by another bundle in
" this running instance. If bundle name is unique and valid, register it to
" current bundle, else show an error.
"
" bundle -- a bundle object whose name is to be checked
" return -- 0 if the bundle's name has been seen before, 1 otherwise
" bundle -- a bundle object whose name is to be checked/registered
" return -- 'new'|'known'|'collision'|'invalid'
" ---------------------------------------------------------------------------
funct! s:check_bundle_name(bundle)
funct! s:register_bundle_name(bundle)
if has_key(s:bundle_names, a:bundle.name)
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
\ '. Plugin ' . s:bundle_names[a:bundle.name] .
\ ' previously used the name "' . a:bundle.name . '"' .
\ '. Skipping Plugin ' . a:bundle.name_spec . '.'
return 0
if s:bundle_names[a:bundle.name]==a:bundle.name_spec
return 'known'
else
echoerr 'Vundle error: Name collision for Plugin ' . a:bundle.name_spec .
\ '. Plugin ' . s:bundle_names[a:bundle.name] .
\ ' previously used the name "' . a:bundle.name . '"' .
\ '. Skipping Plugin ' . a:bundle.name_spec . '.'
return 'collision'
endif
elseif a:bundle.name !~ '\v^[A-Za-z0-9_-]%(\.?[A-Za-z0-9_-])*$'
echoerr 'Invalid plugin name: ' . a:bundle.name
return 0
return 'invalid'
endif
let s:bundle_names[a:bundle.name] = a:bundle.name_spec
return 1
return 'new'
endf


Expand Down
41 changes: 31 additions & 10 deletions autoload/vundle/installer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func! vundle#installer#new(bang, ...) abort
let bundles = filter(copy(g:vundle#bundles), 'index(a:000, v:val.name) > -1')
" Specific plugins are specified for installation. Install them.
else
let bundles = map(copy(a:000), 'vundle#config#bundle(v:val, {})')
let bundles = filter(map(copy(a:000), 'vundle#config#bundle(v:val, {})'),'v:val!={}')
endif

if empty(bundles)
Expand Down Expand Up @@ -150,8 +150,10 @@ endf
func! vundle#installer#install_and_require(bang, name) abort
let result = vundle#installer#install(a:bang, a:name)
let b = vundle#config#bundle(a:name, {})
call vundle#installer#helptags([b])
call vundle#config#require([b])
if b!={}
call vundle#installer#helptags([b])
call vundle#config#require([b])
endif
return result
endf

Expand Down Expand Up @@ -285,7 +287,7 @@ func! vundle#installer#delete(bang, dir_name) abort
let bundle = vundle#config#init_bundle(a:dir_name, {})
let cmd .= ' '.vundle#installer#shellesc(bundle.path())

let out = s:system(cmd)
let out = vundle#installer#system(cmd)

call s:log('')
call s:log('Plugin '.a:dir_name)
Expand Down Expand Up @@ -345,7 +347,7 @@ endf
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 = vundle#installer#shellesc_cd(cmd)
let out = s:strip(s:system(cmd))
let out = s:strip(vundle#installer#system(cmd))
return out
endf

Expand All @@ -359,7 +361,7 @@ endf
func! s:get_current_sha(bundle)
let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD'
let cmd = vundle#installer#shellesc_cd(cmd)
let out = s:system(cmd)[0:15]
let out = vundle#installer#system(cmd)[0:15]
return out
endf

Expand Down Expand Up @@ -446,10 +448,10 @@ func! s:sync(bang, bundle) abort
return 'todate'
endif

let out = s:system(cmd)
call s:log('')
call s:log('Plugin '.a:bundle.name_spec)
call s:log(cmd, '$ ')
let out = vundle#installer#system(cmd)
call s:log(out, '> ')

if 0 != v:shell_error
Expand Down Expand Up @@ -510,9 +512,28 @@ endf
" cmd -- the command passed to system() (string)
" return -- the return value from system()
" ---------------------------------------------------------------------------
func! s:system(cmd) abort
return system(a:cmd)
endf
if (has("win32") || has("win64")) &&
\ (v:version<703 ||
\ (v:version==703 && (!has("patch443") || !has("patch445") || !has("patch446"))) )

func! vundle#installer#system(cmd) abort
" see cmd.exe docs (scroll down to remarks):
" https://technet.microsoft.com/de-de/library/cc771320(v=ws.10).aspx
" and vim patches links: https://github.com/airblade/vim-system-escape
if &shell=~"cmd.exe"
return system('"'.a:cmd.'"')
else
return system(a:cmd)
endif
endf

else

func! vundle#installer#system(cmd) abort
return system(a:cmd)
endf

endif


" ---------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions autoload/vundle/scripts.vim
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func! s:create_changelog() abort

let cmd = vundle#installer#shellesc_cd(cmd)

let updates = system(cmd)
let updates = vundle#installer#system(cmd)

call add(changelog, '')
call add(changelog, 'Updated Plugin: '.bundle.name)
Expand Down Expand Up @@ -239,7 +239,7 @@ func! s:fetch_scripts(to)
return 1
endif

call system(cmd)
call vundle#installer#system(cmd)

if (0 != v:shell_error)
echoerr 'Error fetching scripts!'
Expand Down