Browse Source

added support for specifying specific branch/tag/revision while installing

pull/604/head
Rick van Hattem 11 years ago
parent
commit
272d9fe2bf
3 changed files with 19 additions and 4 deletions
  1. +2
    -0
      README.md
  2. +8
    -1
      autoload/vundle/config.vim
  3. +9
    -3
      autoload/vundle/installer.vim

+ 2
- 0
README.md View File

@ -72,6 +72,8 @@
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}
" Install a specific branch/tag/revision
Plugin 'WoLpH/nerdtree@patch-1'
" All of your Plugins must be added before the following line
call vundle#end() " required


+ 8
- 1
autoload/vundle/config.vim View File

@ -139,6 +139,13 @@ func! s:parse_name(arg)
let arg = a:arg
let git_proto = exists('g:vundle_default_git_proto') ? g:vundle_default_git_proto : 'https'
if arg =~? '@'
let revision = split(arg, '@')[-1]
let arg = split(arg, '@')[0]
else
let revision = 'master'
endif
if arg =~? '^\s*\(gh\|github\):\S\+'
\ || arg =~? '^[a-z0-9][a-z0-9-]*/[^/]\+$'
let uri = git_proto.'://github.com/'.split(arg, ':')[-1]
@ -155,7 +162,7 @@ func! s:parse_name(arg)
let name = arg
let uri = git_proto.'://github.com/vim-scripts/'.name.'.git'
endif
return {'name': name, 'uri': uri, 'name_spec': arg }
return {'name': name, 'uri': uri, 'name_spec': arg, 'revision': revision }
endf


+ 9
- 3
autoload/vundle/installer.vim View File

@ -393,6 +393,7 @@ func! s:make_sync_command(bang, bundle) abort
\ 'git fetch',
\ 'git reset --hard origin/HEAD',
\ 'git submodule update --init --recursive',
\ 'git checkout '.a:bundle.revision,
\ ]
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
@ -410,14 +411,19 @@ func! s:make_sync_command(bang, bundle) abort
\ 'git pull',
\ 'git submodule update --init --recursive',
\ ]
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
let initial_sha = s:get_current_sha(a:bundle)
else
let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path())
let cmd_parts = [
\ 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()),
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ ]
let initial_sha = ''
endif
let cmd_parts = cmd_parts + ['git checkout '.a:bundle.revision]
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
return [cmd, initial_sha]
endf


Loading…
Cancel
Save