Skip to content

Commit cdea024

Browse files
committed
Add g:plug_disable_credential_helper (default: 1)
This can be set to '0' not to disable git credential helper. let g:plug_disable_credential_helper = 0 See #1026 Close #1047
1 parent 9ef7739 commit cdea024

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

plug.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,12 +1075,16 @@ function! s:hash_match(a, b)
10751075
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
10761076
endfunction
10771077

1078+
function! s:disable_credential_helper()
1079+
return s:git_version_requirement(2) && get(g:, 'plug_disable_credential_helper', 1)
1080+
endfunction
1081+
10781082
function! s:checkout(spec)
10791083
let sha = a:spec.commit
10801084
let output = s:git_revision(a:spec.dir)
10811085
let error = 0
10821086
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
1083-
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
1087+
let credential_helper = s:disable_credential_helper() ? '-c credential.helper= ' : ''
10841088
let output = s:system(
10851089
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
10861090
let error = v:shell_error
@@ -1589,7 +1593,7 @@ while 1 " Without TCO, Vim stack is bound to explode
15891593
let [error, _] = s:git_validate(spec, 0)
15901594
if empty(error)
15911595
if pull
1592-
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
1596+
let cmd = s:disable_credential_helper() ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
15931597
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
15941598
call extend(cmd, ['--depth', '99999999'])
15951599
endif

0 commit comments

Comments
 (0)