Skip to content

Commit

Permalink
Revert "Shallow clone by default (#122 #217)"
Browse files Browse the repository at this point in the history
This reverts commit c632c1f.
  • Loading branch information
junegunn committed Apr 28, 2015
1 parent 2218b8f commit 8f1df15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Reload .vimrc and `:PlugInstall` to install plugins.
| `g:plug_threads` | 16 | Default number of threads to use |
| `g:plug_timeout` | 60 | Time limit of each task in seconds (*Ruby & Python*) |
| `g:plug_retries` | 2 | Number of retries in case of timeout (*Ruby & Python*) |
| `g:plug_shallow` | 1 | Use shallow clone |
| `g:plug_window` | `vertical topleft new` | Command to open plug window |
| `g:plug_url_format` | `https://git::@github.com/%s.git` | `printf` format to build repo URL |

Expand Down
14 changes: 4 additions & 10 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -763,9 +763,6 @@ function! s:update_impl(pull, force, args) abort
call append(0, ['', ''])
normal! 2G

let s:clone_opt = get(g:, 'plug_shallow', 1) ?
\ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''

" Python version requirement (>= 2.7)
if s:py2 && !s:ruby && !s:nvim && s:update.threads > 1
redir => pyv
Expand Down Expand Up @@ -982,8 +979,7 @@ while 1 " Without TCO, Vim stack is bound to explode
endif
else
call s:spawn(name,
\ printf('git clone %s %s --recursive %s -b %s %s 2>&1',
\ s:clone_opt,
\ printf('git clone %s --recursive %s -b %s %s 2>&1',
\ prog,
\ s:shellesc(spec.uri),
\ checkout,
Expand Down Expand Up @@ -1020,7 +1016,6 @@ import vim
G_PULL = vim.eval('s:update.pull') == '1'
G_RETRIES = int(vim.eval('get(g:, "plug_retries", 2)')) + 1
G_TIMEOUT = int(vim.eval('get(g:, "plug_timeout", 60)'))
G_CLONE_OPT = vim.eval('s:clone_opt')
G_PROGRESS = vim.eval('s:progress_opt(1)')
G_LOG_PROB = 1.0 / int(vim.eval('s:update.threads'))
G_STOP = thr.Event()
Expand Down Expand Up @@ -1242,8 +1237,8 @@ class Plugin(object):

self.write(Action.INSTALL, self.name, ['Installing ...'])
callback = functools.partial(self.buf.write, Action.INSTALL, self.name)
cmd = 'git clone {0} {1} --recursive {2} -b {3} {4} 2>&1'.format(
G_CLONE_OPT, G_PROGRESS, self.args['uri'], self.checkout, esc(target))
cmd = 'git clone {0} --recursive {1} -b {2} {3} 2>&1'.format(
G_PROGRESS, self.args['uri'], self.checkout, esc(target))
com = Command(cmd, None, G_TIMEOUT, G_RETRIES, callback, clean(target))
result = com.attempt_cmd()
self.write(Action.DONE, self.name, result[-1:])
Expand Down Expand Up @@ -1538,7 +1533,6 @@ function! s:update_ruby()
end
} if VIM::evaluate('s:mac_gui') == 1

clone_opt = VIM::evaluate('s:clone_opt')
progress = VIM::evaluate('s:progress_opt(1)')
nthr.times do
mtx.synchronize do
Expand Down Expand Up @@ -1576,7 +1570,7 @@ function! s:update_ruby()
else
d = esc dir.sub(%r{[\\/]+$}, '')
log.call name, 'Installing ...', :install
bt.call "git clone #{clone_opt} #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc {
bt.call "git clone #{progress} --recursive #{uri} -b #{checkout} #{d} 2>&1", name, :install, proc {
FileUtils.rm_rf dir
}
end
Expand Down
11 changes: 4 additions & 7 deletions test/workflow.vader
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,9 @@ Execute (PlugDiff - 'No updates.'):
AssertEqual 'No updates.', getline(1)
q

Execute (New commits on remote, PlugUpdate, then PlugDiff):
Execute (Rollback recent updates, PlugUpdate, then PlugDiff):
for repo in ['seoul256.vim', 'vim-emoji']
for _ in range(2)
call system(printf('cd /tmp/junegunn/%s && git commit --allow-empty -m "update"', repo))
endfor
call system(printf('cd %s/%s && git reset HEAD^^ --hard', g:plug_home, repo))
endfor
PlugUpdate

Expand Down Expand Up @@ -641,8 +639,8 @@ Execute (On update):
Plug 'junegunn/vim-pseudocl', { 'do': 'touch updated' }
call plug#end()

" New commits on remote
call system('cd /tmp/junegunn/vim-pseudocl && git commit --allow-empty -m "update"')
" Reset for updates
call system('cd '.g:plugs['vim-pseudocl'].dir.' && git reset --hard HEAD^')

silent PlugUpdate
Log getline(1, '$')
Expand Down Expand Up @@ -705,7 +703,6 @@ Execute (Using Funcref):
Plug 'junegunn/vim-pseudocl', { 'do': function('PlugUpdated') }
call plug#end()

call system('cd /tmp/junegunn/vim-easy-align && git commit --allow-empty -m "update"')
call system('cd '.g:plugs['vim-easy-align'].dir.' && git reset --hard HEAD^')
call system('rm -rf '.g:plugs['vim-pseudocl'].dir)

Expand Down

0 comments on commit 8f1df15

Please sign in to comment.