From b44808b7a4743215b66f91b3b230f91de91374e2 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Sat, 29 Dec 2012 12:53:02 +0800 Subject: [PATCH] Move log code into s:system for simplification --- autoload/vundle/installer.vim | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index d78a999..a6c0781 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -172,12 +172,7 @@ func! vundle#installer#delete(bang, dir_name) abort let bundle = vundle#config#init_bundle(a:dir_name, {}) let cmd .= ' '.shellescape(bundle.path()) - let out = s:system(cmd) - - call s:log('') - call s:log('Bundle '.a:dir_name) - call s:log('$ '.cmd) - call s:log('> '.out) + call s:system(dir_name, cmd) if 0 != v:shell_error return 'error' @@ -214,17 +209,13 @@ func! s:sync(bang, bundle) abort let get_current_sha = 'cd '.shellescape(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] + let initial_sha = system(get_current_sha)[0:15] else let cmd = 'git clone --recursive '.shellescape(a:bundle.uri).' '.shellescape(a:bundle.path()) let initial_sha = '' endif - let out = s:system(cmd) - call s:log('') - call s:log('Bundle '.a:bundle.name_spec) - call s:log('$ '.cmd) - call s:log('> '.out) + call s:system(a:bundle.name_spec, cmd) if 0 != v:shell_error return 'error' @@ -234,7 +225,7 @@ func! s:sync(bang, bundle) abort return 'new' endif - let updated_sha = s:system(get_current_sha)[0:15] + let updated_sha = system(get_current_sha)[0:15] if initial_sha == updated_sha return 'todate' @@ -263,8 +254,13 @@ func! g:shellesc_cd(cmd) abort endif endf -func! s:system(cmd) abort - return system(a:cmd) +func! s:system(dir_name, cmd) abort + let out = system(a:cmd) + call s:log('') + call s:log('Bundle '.a:dir_name) + call s:log('$ '.a:cmd) + call s:log('> '.out) + return out endf func! s:log(str) abort