Fix #139 - Use git fetch+merge instead of pull
This commit is contained in:
		
							parent
							
								
									fdf1e53da5
								
							
						
					
					
						commit
						0e9fa672f8
					
				|  | @ -10,6 +10,8 @@ before_script: | | ||||||
|   make |   make | ||||||
|   sudo make install |   sudo make install | ||||||
|   cd - |   cd - | ||||||
|  |   git config --global user.email "you@example.com" | ||||||
|  |   git config --global user.name "Your Name" | ||||||
| 
 | 
 | ||||||
| script: | | script: | | ||||||
|   test/run ! |   test/run ! | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								plug.vim
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								plug.vim
									
									
									
									
									
								
							|  | @ -914,7 +914,7 @@ while 1 " Without TCO, Vim stack is bound to explode | ||||||
|     if valid |     if valid | ||||||
|       if pull |       if pull | ||||||
|         call s:spawn(name, |         call s:spawn(name, | ||||||
|           \ printf('git checkout -q %s 2>&1 && git pull --progress --no-rebase origin %s 2>&1 && git submodule update --init --recursive 2>&1', |           \ printf('(git fetch --progress 2>&1 && git checkout -q %s 2>&1 && git merge --ff-only origin/%s 2>&1 && git submodule update --init --recursive 2>&1)', | ||||||
|           \ s:shellesc(spec.branch), s:shellesc(spec.branch)), { 'dir': spec.dir }) |           \ s:shellesc(spec.branch), s:shellesc(spec.branch)), { 'dir': spec.dir }) | ||||||
|       else |       else | ||||||
|         let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } |         let s:jobs[name] = { 'running': 0, 'result': 'Already installed', 'error': 0 } | ||||||
|  | @ -1125,7 +1125,7 @@ function! s:update_ruby() | ||||||
|               else |               else | ||||||
|                 if pull |                 if pull | ||||||
|                   log.call name, 'Updating ...', :update |                   log.call name, 'Updating ...', :update | ||||||
|                   bt.call "#{cd} #{dir} && git checkout -q #{branch} 2>&1 && (git pull --no-rebase origin #{branch} #{progress} 2>&1 && #{subm})", name, :update, nil |                   bt.call "#{cd} #{dir} && (git fetch #{progress} 2>&1 && git checkout -q #{branch} 2>&1 && git merge --ff-only origin/#{branch} 2>&1 && #{subm})", name, :update, nil | ||||||
|                 else |                 else | ||||||
|                   [true, skip] |                   [true, skip] | ||||||
|                 end |                 end | ||||||
|  |  | ||||||
|  | @ -72,3 +72,80 @@ Execute (#131 Syntax error): | ||||||
|   silent PlugInstall |   silent PlugInstall | ||||||
|   redir END |   redir END | ||||||
|   Assert out =~ 'Invalid plug directory: /no-permission' |   Assert out =~ 'Invalid plug directory: /no-permission' | ||||||
|  | 
 | ||||||
|  | ********************************************************************** | ||||||
|  | Execute (#139-1 Using new remote branch): | ||||||
|  |   " Make sure to remove the clone | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   call plug#end() | ||||||
|  |   PlugClean! | ||||||
|  | 
 | ||||||
|  |   " Install master branch | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   Plug expand('file:///$TMPDIR/new-branch') | ||||||
|  |   call plug#end() | ||||||
|  |   PlugUpdate | ||||||
|  | 
 | ||||||
|  |   unlet! g:foo g:bar g:baz | ||||||
|  |   call plug#load('new-branch') | ||||||
|  |   Assert exists('g:foo'),  'g:foo should be found' | ||||||
|  |   Assert !exists('g:bar'), 'g:bar should not be found' | ||||||
|  |   Assert !exists('g:baz'), 'g:baz should not be found' | ||||||
|  | 
 | ||||||
|  |   " Create a new branch on origin | ||||||
|  |   call system('cd $TMPDIR/new-branch && git checkout -b new &&' | ||||||
|  |       \. 'echo "let g:bar = 1" > plugin/bar.vim && git add plugin/bar.vim &&' | ||||||
|  |       \. 'git commit -m second') | ||||||
|  | 
 | ||||||
|  |   " We're setting up two plugins so that parallel installer is used | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   Plug 'junegunn/seoul256.vim' | ||||||
|  |   Plug expand('file:///$TMPDIR/new-branch'), 'new' | ||||||
|  |   call plug#end() | ||||||
|  |   PlugUpdate | ||||||
|  |   silent %y | ||||||
|  |   Log @" | ||||||
|  |   Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @" | ||||||
|  | 
 | ||||||
|  |   unlet! g:foo g:bar g:baz | ||||||
|  |   call plug#load('new-branch') | ||||||
|  |   Assert exists('g:foo'),  'g:foo should be found' | ||||||
|  |   Assert exists('g:bar'),  'g:bar should be found' | ||||||
|  |   Assert !exists('g:baz'), 'g:baz should not be found' | ||||||
|  | 
 | ||||||
|  |   call PlugStatusSorted() | ||||||
|  | 
 | ||||||
|  | Expect: | ||||||
|  |   - new-branch: OK | ||||||
|  |   - seoul256.vim: OK | ||||||
|  |   Finished. 0 error(s). | ||||||
|  |   [==] | ||||||
|  | 
 | ||||||
|  | Execute (#139-2 Using yet another new remote branch): | ||||||
|  |   " Create another branch on origin | ||||||
|  |   call system('cd $TMPDIR/new-branch && git checkout master &&' | ||||||
|  |       \. 'git checkout -b brand-new &&' | ||||||
|  |       \. 'echo "let g:baz = 1" > plugin/baz.vim && git add plugin/baz.vim &&' | ||||||
|  |       \. 'git commit -m thirf') | ||||||
|  | 
 | ||||||
|  |   " Test Vim installer here | ||||||
|  |   call plug#begin('$TMPDIR/plugged') | ||||||
|  |   Plug expand('file:///$TMPDIR/new-branch'), 'brand-new' | ||||||
|  |   call plug#end() | ||||||
|  |   PlugUpdate | ||||||
|  |   silent %y | ||||||
|  |   Log @" | ||||||
|  |   Assert @" !~? 'error', 'Should be able to use new remote branch: ' . @" | ||||||
|  | 
 | ||||||
|  |   unlet! g:foo g:bar g:baz | ||||||
|  |   call plug#load('new-branch') | ||||||
|  |   Assert exists('g:foo'),  'g:foo should be found' | ||||||
|  |   Assert !exists('g:bar'), 'g:bar should not be found' | ||||||
|  |   Assert exists('g:baz'),  'g:baz should be found' | ||||||
|  | 
 | ||||||
|  |   call PlugStatusSorted() | ||||||
|  | 
 | ||||||
|  | Expect: | ||||||
|  |   - new-branch: OK | ||||||
|  |   Finished. 0 error(s). | ||||||
|  |   [=] | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								test/run
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								test/run
									
									
									
									
									
								
							|  | @ -51,6 +51,7 @@ EOF | ||||||
| 
 | 
 | ||||||
| init() { | init() { | ||||||
|   rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2} |   rm -rf $PLUG_FIXTURES/{xxx,yyy,z1,z2} | ||||||
|  |   rm -rf $TMPDIR/new-branch | ||||||
| 
 | 
 | ||||||
|   make_dirs xxx/ xxx |   make_dirs xxx/ xxx | ||||||
|   make_dirs xxx/after xxx |   make_dirs xxx/after xxx | ||||||
|  | @ -64,6 +65,16 @@ DOC | ||||||
| 
 | 
 | ||||||
|   make_dirs z1/ z1 |   make_dirs z1/ z1 | ||||||
|   make_dirs z2/ z2 |   make_dirs z2/ z2 | ||||||
|  | 
 | ||||||
|  |   ( | ||||||
|  |     cd $TMPDIR | ||||||
|  |     git init new-branch | ||||||
|  |     cd new-branch | ||||||
|  |     mkdir plugin | ||||||
|  |     echo 'let g:foo = 1' > plugin/foo.vim | ||||||
|  |     git add plugin/foo.vim | ||||||
|  |     git commit -m initial | ||||||
|  |   ) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| cat > /tmp/mini-vimrc << VIMRC | cat > /tmp/mini-vimrc << VIMRC | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user