Skip to content

Commit 59a315c

Browse files
diabonasnalimilan
andauthored
LibGit2: add resolve_url to RemoteCallbacksStruct for LibGit2 0.99.0 (#35232)
* LibGit2: amend GitError enum Since upstream commit libgit2/libgit2@e9cef7c ("http: introduce GIT_ERROR_HTTP") an invalid content type yields a GIT_ERROR_HTTP instead of a GIT_ERROR_NET error. Update the enum to include this new error so that the unit test for LibGit2 doesn't fail with "invalid value for Enum Class: 34". * LibGit2: add resolve_url to RemoteCallbacksStruct for LibGit2 0.99.0 Upstream commit libgit2/libgit2@59647e1 ("remote: add callback to resolve URLs before connecting") introduced a new callback "resolve_url" in LibGit2 0.99.0. Even though it is not currently used in Julia, it needs to be accounted for to get the correct size for FetchOptionsStruct. An incorrectly aligned FetchOptionsStruct leads to error messages like "invalid version 0 on git_proxy_options" when trying to use the latest LibGit2 version. * LibGit2: update error message checking for LibGit2 0.99.0 Upstream commit libgit2/libgit2@b9c5b15 ("http: use the new httpclient") changed the error message to include additional quotes. Relax the unit test to allow these if present. Co-authored-by: Milan Bouchet-Valat <nalimilan@club.fr>
1 parent acd0e83 commit 59a315c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

stdlib/LibGit2/src/error.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ export GitError
5858
Callback,
5959
CherryPick,
6060
Describe,
61-
Rebase)
61+
Rebase,
62+
Filesystem,
63+
Patch,
64+
WorkTree,
65+
SHA1,
66+
HTTP)
6267

6368
struct ErrorStruct
6469
message::Ptr{UInt8}

stdlib/LibGit2/src/types.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ end
223223
push_negotiation::Ptr{Cvoid} = C_NULL
224224
transport::Ptr{Cvoid} = C_NULL
225225
payload::Ptr{Cvoid} = C_NULL
226+
@static if LibGit2.VERSION >= v"0.99.0"
227+
resolve_url::Ptr{Cvoid} = C_NULL
228+
end
226229
end
227230

228231
"""

stdlib/LibGit2/test/libgit2.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,7 @@ mktempdir() do dir
30483048
deserialize(f)
30493049
end
30503050
@test err.code == LibGit2.Error.ERROR
3051-
@test lowercase(err.msg) == lowercase("invalid Content-Type: text/plain")
3051+
@test occursin(r"invalid content-type: '?text/plain'?"i, err.msg)
30523052
end
30533053

30543054
# OpenSSL s_server should still be running

0 commit comments

Comments
 (0)