Skip to content

Commit 4c8e693

Browse files
authored
Merge pull request #23573 from JuliaLang/cv/libgit2-helper-error
Refactor LibGit2 credential_loop tests
2 parents caad8b2 + 10cf8a2 commit 4c8e693

File tree

3 files changed

+168
-170
lines changed

3 files changed

+168
-170
lines changed

test/TestHelpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function with_fake_pty(f)
5353
end
5454
end
5555

56-
function challenge_prompt(code::AbstractString, challenges; timeout::Integer=10, debug::Bool=true)
56+
function challenge_prompt(code::Expr, challenges; timeout::Integer=10, debug::Bool=true)
5757
output_file = tempname()
5858
wrapped_code = """
5959
result = let

test/libgit2-helpers.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ function credential_loop(
3939
end
4040
end
4141

42-
return err, num_authentications
42+
# Note: LibGit2.GitError(0) will not work if an error message has been set.
43+
git_error = if err == 0
44+
LibGit2.GitError(LibGit2.Error.None, LibGit2.Error.GIT_OK, "No errors")
45+
else
46+
LibGit2.GitError(err)
47+
end
48+
49+
return git_error, num_authentications
4350
end
4451

4552
function credential_loop(

0 commit comments

Comments
 (0)