Skip to content

Commit f1593e1

Browse files
omusKristofferC
authored andcommitted
Support git config credential resetting (#35064)
(cherry picked from commit 0f1b119)
1 parent 5cf6725 commit f1593e1

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

stdlib/LibGit2/src/gitcredential.jl

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -222,21 +222,11 @@ function credential_helpers(cfg::GitConfig, cred::GitCredential)
222222
ismatch(url, cred) || continue
223223

224224
# An empty credential.helper resets the list to empty
225-
isempty(value) && empty!(helpers)
226-
227-
# Due to a bug in libgit2 iteration we may read credential helpers out of order.
228-
# See: https://github.com/libgit2/libgit2/issues/4361
229-
#
230-
# Typically the ordering doesn't matter but does in this particular case. Disabling
231-
# credential helpers avoids potential issues with using the wrong credentials or
232-
# writing credentials to the wrong helper.
233225
if isempty(value)
234-
@warn """Resetting the helper list is currently unsupported:
235-
ignoring all git credential helpers""" maxlog=1
236-
return GitCredentialHelper[]
226+
empty!(helpers)
227+
else
228+
Base.push!(helpers, parse(GitCredentialHelper, value))
237229
end
238-
239-
Base.push!(helpers, parse(GitCredentialHelper, value))
240230
end
241231

242232
return helpers

stdlib/LibGit2/test/libgit2.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1980,9 +1980,7 @@ mktempdir() do dir
19801980
mygit_cred = GitCredential("https", "mygithost")
19811981

19821982
@test LibGit2.credential_helpers(cfg, github_cred) == expected
1983-
1984-
println(stderr, "The following 'Resetting the helper list...' warning is expected:")
1985-
@test_broken LibGit2.credential_helpers(cfg, mygit_cred) == expected[2]
1983+
@test LibGit2.credential_helpers(cfg, mygit_cred) == expected[2:2]
19861984

19871985
Base.shred!(github_cred)
19881986
Base.shred!(mygit_cred)

0 commit comments

Comments
 (0)