@@ -405,17 +405,41 @@ func! s:make_sync_command(bang, bundle) abort
405405 return [' ' , ' ' ]
406406 endif
407407
408- let cmd_parts = [
409- \ ' cd ' .vundle#installer#shellesc (a: bundle .path ()),
410- \ ' git pull' ,
411- \ ' git submodule update --init --recursive' ,
412- \ ]
408+ let cmd_parts = [' cd ' .vundle#installer#shellesc (a: bundle .path ())]
409+ if (has_key (a: bundle , ' version' ))
410+ echo " Processing '" .a: bundle .name." ' version " .a: bundle .version
411+ call extend (cmd_parts, [
412+ \ ' git fetch' ,
413+ \ ' git checkout tags/' .vundle#installer#shellesc (a: bundle .version ),
414+ \ ])
415+ else
416+ call extend (cmd_parts, [
417+ \ ' git checkout master' ,
418+ \ ' git pull' ,
419+ \ ])
420+ endif
421+ call add (cmd_parts, ' git submodule update --init --recursive' )
422+
413423 let cmd = join (cmd_parts, ' && ' )
414424 let cmd = vundle#installer#shellesc_cd (cmd)
415425
416426 let initial_sha = s: get_current_sha (a: bundle )
417427 else
418- let cmd = ' git clone --recursive ' .vundle#installer#shellesc (a: bundle .uri).' ' .vundle#installer#shellesc (a: bundle .path ())
428+ let cmd_parts = [
429+ \ ' git clone --recursive ' .vundle#installer#shellesc (a: bundle .uri).' ' .vundle#installer#shellesc (a: bundle .path ()),
430+ \ ]
431+
432+ if (has_key (a: bundle , ' version' ))
433+ echo " Processing '" .a: bundle .name." ' version " .a: bundle .version
434+ call extend (cmd_parts, [
435+ \ ' cd ' .vundle#installer#shellesc (a: bundle .path ()),
436+ \ ' git checkout tags/' .vundle#installer#shellesc (a: bundle .version ),
437+ \ ])
438+ endif
439+
440+ let cmd = join (cmd_parts, ' && ' )
441+ let cmd = vundle#installer#shellesc_cd (cmd)
442+
419443 let initial_sha = ' '
420444 endif
421445 return [cmd, initial_sha]
0 commit comments