get rid of error code, match error status too

This commit is contained in:
gmarik 2011-08-04 21:09:25 -05:00
parent d37ab79841
commit 60f299b227

View File

@ -47,19 +47,17 @@ func! vundle#installer#install(bang, name) abort
echo 'Installing '.b.name echo 'Installing '.b.name
let [err_code, status] = s:sync(a:bang, b) let status = s:sync(a:bang, b)
redraw! redraw!
if 0 == err_code if 'updated' == status
if 'updated' == status echo b.name.' installed'
echo b.name.' installed' exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$")
exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$") elseif 'uptodate' == status
elseif 'uptodate' == status echo b.name.' already installed'
echo b.name.' already installed' exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$")
exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$") elseif 'error' == status
endif
else
echohl Error echohl Error
echo 'Error installing "'.b.name echo 'Error installing "'.b.name
echohl None echohl None
@ -117,7 +115,7 @@ endf
func! s:sync(bang, bundle) abort func! s:sync(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/') let git_dir = expand(a:bundle.path().'/.git/')
if isdirectory(git_dir) if isdirectory(git_dir)
if !(a:bang) | return [0, 'uptodate'] | endif if !(a:bang) | return 'uptodate' | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
if (has('win32') || has('win64')) if (has('win32') || has('win64'))
@ -131,14 +129,14 @@ func! s:sync(bang, bundle) abort
let out = s:system(cmd) let out = s:system(cmd)
if 0 != v:shell_error if 0 != v:shell_error
return [v:shell_error, 'error'] return 'error'
end end
if out =~# 'up-to-date' if out =~# 'up-to-date'
return [0, 'uptodate'] return 'uptodate'
end end
return [0, 'updated'] return 'updated'
endf endf
func! s:system(cmd) abort func! s:system(cmd) abort