Set empty credential.helper only when git 2.0 or above is available
Fix #1031
This commit is contained in:
parent
ab940f624a
commit
2f4e28161e
1 changed files with 4 additions and 3 deletions
7
plug.vim
7
plug.vim
|
@ -1078,8 +1078,9 @@ function! s:checkout(spec)
|
||||||
let sha = a:spec.commit
|
let sha = a:spec.commit
|
||||||
let output = s:git_revision(a:spec.dir)
|
let output = s:git_revision(a:spec.dir)
|
||||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||||
|
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
||||||
let output = s:system(
|
let output = s:system(
|
||||||
\ 'git -c credential.helper= fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||||
endif
|
endif
|
||||||
return output
|
return output
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -1847,7 +1848,7 @@ class Plugin(object):
|
||||||
self.write(Action.UPDATE, self.name, ['Updating ...'])
|
self.write(Action.UPDATE, self.name, ['Updating ...'])
|
||||||
callback = functools.partial(self.write, Action.UPDATE, self.name)
|
callback = functools.partial(self.write, Action.UPDATE, self.name)
|
||||||
fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else ''
|
fetch_opt = '--depth 99999999' if self.tag and os.path.isfile(os.path.join(self.args['dir'], '.git/shallow')) else ''
|
||||||
cmd = 'git -c credential.helper= fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
|
cmd = 'git fetch {0} {1} 2>&1'.format(fetch_opt, G_PROGRESS)
|
||||||
com = Command(cmd, self.args['dir'], G_TIMEOUT, callback)
|
com = Command(cmd, self.args['dir'], G_TIMEOUT, callback)
|
||||||
result = com.execute(G_RETRIES)
|
result = com.execute(G_RETRIES)
|
||||||
self.write(Action.DONE, self.name, result[-1:])
|
self.write(Action.DONE, self.name, result[-1:])
|
||||||
|
@ -2155,7 +2156,7 @@ function! s:update_ruby()
|
||||||
if pull
|
if pull
|
||||||
log.call name, 'Updating ...', :update
|
log.call name, 'Updating ...', :update
|
||||||
fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : ''
|
fetch_opt = (tag && File.exist?(File.join(dir, '.git/shallow'))) ? '--depth 99999999' : ''
|
||||||
bt.call "#{chdir} && git -c credential.helper= fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
|
bt.call "#{chdir} && git fetch #{fetch_opt} #{progress} 2>&1", name, :update, nil
|
||||||
else
|
else
|
||||||
[true, skip]
|
[true, skip]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue