Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few libgit2 improvements/fixes #51259

Merged
merged 5 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions deps/checksums/libgit2
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
LibGit2.v1.6.4+0.aarch64-apple-darwin.tar.gz/md5/dd001ebe432b91c4043739a0aa14d3bf
LibGit2.v1.6.4+0.aarch64-apple-darwin.tar.gz/sha512/c921c9b7b4cba17c98a7f07e003cb9279ae40346e2977a0c2e257c6f6927726f09d0339e139e3a138ed84e169e00d459502a90724077cb253d52ec39a3766c28
LibGit2.v1.6.4+0.aarch64-linux-gnu.tar.gz/md5/a044b38cc6396221c4687dc0723b33fd
LibGit2.v1.6.4+0.aarch64-linux-gnu.tar.gz/sha512/dd804c31645873f18f612920d1e4d4d7adfc828f8d96c8f03ce4e4c856608663ccd26ec9bfae30cd499cefd02b3b7ae648b8617b3d3de9364fbfea094777e7e4
LibGit2.v1.6.4+0.aarch64-linux-musl.tar.gz/md5/8b15c173d188ef2d0bbe1cbd2fe25a0e
LibGit2.v1.6.4+0.aarch64-linux-musl.tar.gz/sha512/a1ddb011a92e8ab0ed6d005d354af23261c5c7949d43b610ba24867bb8065c73820326d14dba069a7d1497758e8c6e1a26a92c7e4c345c75cac2c6d9a7ddfbc0
LibGit2.v1.6.4+0.armv6l-linux-gnueabihf.tar.gz/md5/8d49bb6c15477fa167519477ba43ccb4
LibGit2.v1.6.4+0.armv6l-linux-gnueabihf.tar.gz/sha512/720a76aff31986084b4113734d4fc51b0225242fc53f103a2f1ec89c93a85f5c746df7ac0d98502e47b033d3777bd7e44b95b4bbadb2f27be538fb24fea03425
LibGit2.v1.6.4+0.armv6l-linux-musleabihf.tar.gz/md5/a024f6a4ae55b38ca9c32b6183c75f57
LibGit2.v1.6.4+0.armv6l-linux-musleabihf.tar.gz/sha512/f5a2d1426a6dafd9af0109782805cfe5b07c186947b83053390ce9930fefa2cdb2fd913c93213ff0cd5e4cd1ed43c1a17357cbfdbfe5428a07a95058bebabd85
LibGit2.v1.6.4+0.armv7l-linux-gnueabihf.tar.gz/md5/9b33cb013b7126adce97a6f4d0957cd1
LibGit2.v1.6.4+0.armv7l-linux-gnueabihf.tar.gz/sha512/ec5690027319bf11122b1a5abeb2dd3bc03dd9696b29faa10c543970288ec13f0c462c99d7c4cccff472f26af17525ef475bdd6ccda8de63ae233c7df3b8694d
LibGit2.v1.6.4+0.armv7l-linux-musleabihf.tar.gz/md5/81d1e5c46f1eee85b0ed0f069557ba0f
LibGit2.v1.6.4+0.armv7l-linux-musleabihf.tar.gz/sha512/635c55b08db5eea7e51b09be6236915edc6020831021e3e3fc43a9a7c6ea006a0b83958547898fd990954539b85a059550b60359305fa81ae9b8b514c4039b9e
LibGit2.v1.6.4+0.i686-linux-gnu.tar.gz/md5/7e8edfafd59cec5964ceef7b5a1ff564
LibGit2.v1.6.4+0.i686-linux-gnu.tar.gz/sha512/7b358260ceac13bd58df8cba3ec11e57b07222c792173715191af15c6d567129c5d3a57f1005ad0f0589a692cf435ca2702e30d487e5d48a37d6d34e9d89c98d
LibGit2.v1.6.4+0.i686-linux-musl.tar.gz/md5/e9e3bcd77942e098147d7abdb8abe87a
LibGit2.v1.6.4+0.i686-linux-musl.tar.gz/sha512/f01e57fea3ba1b703350ebd499456e9d8da65abcfb42ad0fad5df1315de74def962045b52b5efa3d657aced1cdd7ef1c56a473febd3682678e9253fbda462f02
LibGit2.v1.6.4+0.i686-w64-mingw32.tar.gz/md5/92e003bad6631bb28833a8d0b10a34de
LibGit2.v1.6.4+0.i686-w64-mingw32.tar.gz/sha512/64ba60cacf2fb63bc6e02558fcfbca2d793a8a92ba6ab7200d35368581a674cb64437f209adbbda5cad4921209622addf61485d3f370f9ce540b6487f7967d07
LibGit2.v1.6.4+0.powerpc64le-linux-gnu.tar.gz/md5/a26f77b89c70edfe386ca75f8b945f65
LibGit2.v1.6.4+0.powerpc64le-linux-gnu.tar.gz/sha512/7edff494558501245b575fb4d42e2279d98c4ad9ccbc625149db8bbbd379cbe5054b6369149dc1a66f5c91ba21a5609f3971a31cea5f0f7a16e67e991496f8cb
LibGit2.v1.6.4+0.x86_64-apple-darwin.tar.gz/md5/c0b79aad1765e0841d229d62dcf34105
LibGit2.v1.6.4+0.x86_64-apple-darwin.tar.gz/sha512/1c3d0f696fe3fe5fa3269057c3d1863e84aff002a142f088129efc6e0e9f32df5db609732e4ad6c6ddf7a2c3f0b7ed53a06c9f4d49b518c0aa960ed04c71e6f2
LibGit2.v1.6.4+0.x86_64-linux-gnu.tar.gz/md5/397c71f23f48eb8395c9e0a605bd3696
LibGit2.v1.6.4+0.x86_64-linux-gnu.tar.gz/sha512/9b785ff277206988d60fbd105beaaeae49b4fa057e1d52f95f4b7a1eff5eceb4525a7a9015823bada6329d0a6b3be8e8ca94221c3b98b287d077b524aa4a517f
LibGit2.v1.6.4+0.x86_64-linux-musl.tar.gz/md5/e7404be38fa8c10740101c5ca1ed9bfd
LibGit2.v1.6.4+0.x86_64-linux-musl.tar.gz/sha512/a2902d50a17c8f61ec5d38d0d843443be2ce4f51292655961d685203860a8f2d098e4dffb10f46f885cc4df1e9f1a5237be2cb31950d9e4a073a78ca82e39989
LibGit2.v1.6.4+0.x86_64-unknown-freebsd.tar.gz/md5/5f370e6f38b38e663dc47b59f295b3b1
LibGit2.v1.6.4+0.x86_64-unknown-freebsd.tar.gz/sha512/2557e8b2dd8925602b2a04c60cf1c49b5b7c395b18ab0045d6bc5287a418463d065335e5e8c4478b70e48a88cae8f9314b348aca560ad7c03191e50eb8c8cf64
LibGit2.v1.6.4+0.x86_64-w64-mingw32.tar.gz/md5/fdf688b0d3c14015775af60a2716d445
LibGit2.v1.6.4+0.x86_64-w64-mingw32.tar.gz/sha512/05fc6d0dc15cf887d83ee4d7d9605171df9a74b532429fdd070ebe443eaf52b190deafb3fec8af5748dffaee05c979e2646dfd009998fcaaf6aeb6caa499bf7c
LibGit2.v1.7.1+0.aarch64-apple-darwin.tar.gz/md5/80102fd8cd633a4875a1257bd61d4e17
LibGit2.v1.7.1+0.aarch64-apple-darwin.tar.gz/sha512/3cc3679923c36e0020e692e79112a8fa71b53c1b83c9bea8d6defda124722a67c2859089d36fddef7be4547539575483db32de8137b43f7fc97843e579a02696
LibGit2.v1.7.1+0.aarch64-linux-gnu.tar.gz/md5/74be95a3f7886a9804964f024df5311f
LibGit2.v1.7.1+0.aarch64-linux-gnu.tar.gz/sha512/3ad8a3c9ced9be2ab5fefe651f445a26900beae743127dcd1f887d01a7672d5d6c523641ba7d402620f3c44a1cc9557e43e11ad1692726c8cfabecca59a030e9
LibGit2.v1.7.1+0.aarch64-linux-musl.tar.gz/md5/e63f4351250b4f4ac60d66b0bed2ddf5
LibGit2.v1.7.1+0.aarch64-linux-musl.tar.gz/sha512/8f2dd17fe55b7cf7cf60504e5b630b22ce27e4e89d75f7e93dba3b112f662470612987e09abd82c2e3df48fc3c0fe1dbf98c690d972edb50c10a5571741cd9e8
LibGit2.v1.7.1+0.armv6l-linux-gnueabihf.tar.gz/md5/f06611068a36fa575ec8eb219c068723
LibGit2.v1.7.1+0.armv6l-linux-gnueabihf.tar.gz/sha512/04c554b9617300cea7750d18590e1a5629e70274ef1e1e8fdabbb4347e46fd8a68e82ba21714d7cd3809c3b6de2e254baca35ff60a4be87485643c460b10ac73
LibGit2.v1.7.1+0.armv6l-linux-musleabihf.tar.gz/md5/7135ca6e52bf63855c5b6aa45d59ad80
LibGit2.v1.7.1+0.armv6l-linux-musleabihf.tar.gz/sha512/e542180d2d8a0896ec586edac03b91d48d2ece3d22220d09b6e717b1b95a38bc1de2ae0faeed39dd3e99150684441bfb0504b55b3e18e543e00561f91147d405
LibGit2.v1.7.1+0.armv7l-linux-gnueabihf.tar.gz/md5/7ffc92c821ec99bd76865ece43f5face
LibGit2.v1.7.1+0.armv7l-linux-gnueabihf.tar.gz/sha512/c945a0895be07479fd94c3c127060e58866bc9b9c93e80dc923ecdda6689e43d566896ecf4bfc7d85ca710b9ee51e6d85dec423edc48a3a2066db0fbb118d073
LibGit2.v1.7.1+0.armv7l-linux-musleabihf.tar.gz/md5/3d00a6223612c23ac6b3c1f44bff8119
LibGit2.v1.7.1+0.armv7l-linux-musleabihf.tar.gz/sha512/c3ef7783f140b28ad2d10e1c16f5be683d3332a4f9db5d26fdf3f2ac2b750aa0ceaec928740a9bdf7f4d9e83f666aa6e5fdd9c019630bf46f6797000943e1510
LibGit2.v1.7.1+0.i686-linux-gnu.tar.gz/md5/6ea4e6777f5a8630f9fa98fb6a4a4ac7
LibGit2.v1.7.1+0.i686-linux-gnu.tar.gz/sha512/d62a46b54dfc491a88fa35d06f3ed9c76ce676473b33acd5382e72ce07e6a313505755476c4732b7a22cd774ddcdf4ea5e8a5b62b93eb48b67363911655ac177
LibGit2.v1.7.1+0.i686-linux-musl.tar.gz/md5/9f74dc4e93886f011412a4f61dfb487f
LibGit2.v1.7.1+0.i686-linux-musl.tar.gz/sha512/1370cab2ef917aa759dd4986f247a6b4878f12c4b17399fa75c9a2878f86c136e6f2f998a396df0757bf36ac09d5d194e4b7688705d115f09c176f4a5ab22347
LibGit2.v1.7.1+0.i686-w64-mingw32.tar.gz/md5/ce866e600b2ad8c0fd54ff8c57dc015c
LibGit2.v1.7.1+0.i686-w64-mingw32.tar.gz/sha512/c7848b39f3515452e13fb156ee645f9a8d3917374ba874b10437b417b3c8e9a108e014b3baf30c7ced5fd0034d4f37de7e7d76fb105358d8e953dca30c873dc6
LibGit2.v1.7.1+0.powerpc64le-linux-gnu.tar.gz/md5/b7c2f120e33f499860cb1e096923e7fe
LibGit2.v1.7.1+0.powerpc64le-linux-gnu.tar.gz/sha512/3df8e54d2086fbedb55b5dc31a2010f2ecd277089293473607e780340882bda5b2f9a2cc1c53c88bd7fcca0791cc2530645ceda17de3f37bb1ff98a19ccb85cf
LibGit2.v1.7.1+0.x86_64-apple-darwin.tar.gz/md5/b5334bd7e44c2c28705bb816fe03b9b7
LibGit2.v1.7.1+0.x86_64-apple-darwin.tar.gz/sha512/d91cfde393499687cc699d55184c58ee5f543108902bf1f08fde2270dec0f38e0d70cbc7af04ffe46952afad12ce008e745f4aae9084f23df58982c14b48117c
LibGit2.v1.7.1+0.x86_64-linux-gnu.tar.gz/md5/9e2e2fe324a40bb0a5364d218c5ce45e
LibGit2.v1.7.1+0.x86_64-linux-gnu.tar.gz/sha512/da7e28c20c09c5c0731fd5cdff6fa6c319b2c4757d5c4228fc287238cd649f98c689814480119f21cbb938a29f52c895021b44c74eccc2f93ae51766555d9b6a
LibGit2.v1.7.1+0.x86_64-linux-musl.tar.gz/md5/7147480b9520116eb63ee3c30fa60a21
LibGit2.v1.7.1+0.x86_64-linux-musl.tar.gz/sha512/f3dfb2a416cb786f229fe9eb3ef653a30ba5ebf3b978475f0a10fa79fa68b7bce9b6d99aed19f8dfb5599d988e3c6d4ede9ef1a6ccdbb3c2ea61f76b97d7fb29
LibGit2.v1.7.1+0.x86_64-unknown-freebsd.tar.gz/md5/39e1a6d463e52ca0b2a1a8e6c3c4a286
LibGit2.v1.7.1+0.x86_64-unknown-freebsd.tar.gz/sha512/3978ba9923cc8a188aca36d7320d46b2788de27142d11920976c47ad43574ad7056539812cebab62550e656b263c2d277754c341bd83d013de608a91e6a0aad3
LibGit2.v1.7.1+0.x86_64-w64-mingw32.tar.gz/md5/7d92c546023f460741a8187999b76bbe
LibGit2.v1.7.1+0.x86_64-w64-mingw32.tar.gz/sha512/da00d54f969ce3b70cc95dda281ddfafee72073164c31d7999053ed704a59401d64894ad702306d6e19eb1a60e5e98e5960c9c7e9a0e1645a0f3048422e62eb9
libgit2-e6325351ceee58cf56f58bdce61b38907805544f.tar.gz/md5/08777cc257825f218ceac1a24abafdc9
libgit2-e6325351ceee58cf56f58bdce61b38907805544f.tar.gz/sha512/ebeaf3bb12ce7d58cd6d36e0123168de3af8f083f707dc20df9781537e38188a176667ac51daf8d9006d54f2beed13fbfff6c26fbb48e3228988578ef8fbc9b7
4 changes: 2 additions & 2 deletions deps/libgit2.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
LIBGIT2_JLL_NAME := LibGit2

## source build
LIBGIT2_BRANCH=v1.6.4
LIBGIT2_SHA1=e6325351ceee58cf56f58bdce61b38907805544f
LIBGIT2_BRANCH=v1.7.1
LIBGIT2_SHA1=a2bde63741977ca0f4ef7db2f609df320be67a08

## Other deps
# Specify the version of the Mozilla CA Certificate Store to obtain.
Expand Down
38 changes: 38 additions & 0 deletions stdlib/LibGit2/src/LibGit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,44 @@ function clone(repo_url::AbstractString, repo_path::AbstractString;
return repo
end

"""
connect(rmt::GitRemote, direction::Consts.GIT_DIRECTION; kwargs...)

Open a connection to a remote. `direction` can be either `DIRECTION_FETCH`
or `DIRECTION_PUSH`.

The keyword arguments are:
* `credentials::Creds=nothing`: provides credentials and/or settings when authenticating
against a private repository.
* `callbacks::Callbacks=Callbacks()`: user provided callbacks and payloads.
"""
function connect(rmt::GitRemote, direction::Consts.GIT_DIRECTION;
credentials::Creds=nothing,
callbacks::Callbacks=Callbacks())
cred_payload = reset!(CredentialPayload(credentials))
if !haskey(callbacks, :credentials)
callbacks[:credentials] = (credentials_cb(), cred_payload)
elseif haskey(callbacks, :credentials) && credentials !== nothing
throw(ArgumentError(string(
"Unable to both use the provided `credentials` as a payload when the ",
"`callbacks` also contain a credentials payload.")))
end

remote_callbacks = RemoteCallbacks(callbacks)
try
connect(rmt, direction, remote_callbacks)
catch err
if isa(err, GitError) && err.code === Error.EAUTH
reject(cred_payload)
else
Base.shred!(cred_payload)
end
rethrow()
end
approve(cred_payload)
return rmt
end

""" git reset [<committish>] [--] <pathspecs>... """
function reset!(repo::GitRepo, committish::AbstractString, pathspecs::AbstractString...)
obj = GitObject(repo, isempty(committish) ? Consts.HEAD_FILE : committish)
Expand Down
42 changes: 42 additions & 0 deletions stdlib/LibGit2/src/commit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,45 @@ function commit(repo::GitRepo, msg::AbstractString;
end
return commit_id
end

"""
parentcount(c::GitCommit)

Get the number of parents of this commit.

See also [`parent`](@ref), [`parent_id`](@ref).
"""
parentcount(c::GitCommit) =
Int(ccall((:git_commit_parentcount, libgit2), Cuint, (Ptr{Cvoid},), c))

"""
parent(c::GitCommit, n)

Get the `n`-th (1-based) parent of the commit.

See also [`parentcount`](@ref), [`parent_id`](@ref).
"""
function parent(c::GitCommit, n)
ptr_ref = Ref{Ptr{Cvoid}}()
@check ccall((:git_commit_parent, libgit2), Cint,
(Ptr{Ptr{Cvoid}}, Ptr{Cvoid}, Cuint), ptr_ref, c, n - 1)
return GitCommit(c.owner, ptr_ref[])
end

"""
parent_id(c::GitCommit, n)

Get the oid of the `n`-th (1-based) parent for a commit.

See also [`parentcount`](@ref), [`parent`](@ref).
"""
function parent_id(c::GitCommit, n)
oid_ptr = ccall((:git_commit_parent_id, libgit2), Ptr{GitHash},
(Ptr{Cvoid}, Cuint), c, n - 1)
if oid_ptr == C_NULL
# 0-based indexing mimicking the error message from libgit2
throw(GitError(Error.Invalid, Error.ENOTFOUND,
"parent $(n - 1) does not exist"))
end
return unsafe_load(oid_ptr)
end
Loading