@@ -1075,12 +1075,16 @@ function! s:hash_match(a, b)
1075
1075
return stridx (a: a , a: b ) == 0 || stridx (a: b , a: a ) == 0
1076
1076
endfunction
1077
1077
1078
+ function ! s: disable_credential_helper ()
1079
+ return s: git_version_requirement (2 ) && get (g: , ' plug_disable_credential_helper' , 1 )
1080
+ endfunction
1081
+
1078
1082
function ! s: checkout (spec)
1079
1083
let sha = a: spec .commit
1080
1084
let output = s: git_revision (a: spec .dir )
1081
1085
let error = 0
1082
1086
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= ' : ' '
1084
1088
let output = s: system (
1085
1089
\ ' git ' .credential_helper.' fetch --depth 999999 && git checkout ' .plug#shellescape (sha).' --' , a: spec .dir )
1086
1090
let error = v: shell_error
@@ -1589,7 +1593,7 @@ while 1 " Without TCO, Vim stack is bound to explode
1589
1593
let [error , _] = s: git_validate (spec, 0 )
1590
1594
if empty (error )
1591
1595
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' ]
1593
1597
if has_tag && ! empty (globpath (spec.dir , ' .git/shallow' ))
1594
1598
call extend (cmd, [' --depth' , ' 99999999' ])
1595
1599
endif
0 commit comments