git2: 0.20 → 0.21

This commit is contained in:
Lorenz Leutgeb
2026-05-21 09:14:47 +01:00
committed by Fintan Halpenny
parent fffcfa433d
commit 354fa416f9
6 changed files with 17 additions and 11 deletions
Generated
+4 -5
View File
@@ -294,15 +294,14 @@ dependencies = [
[[package]] [[package]]
name = "git2" name = "git2"
version = "0.20.4" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b88256088d75a56f8ecfa070513a775dd9107f6530ef14919dac831af9cfe2b" checksum = "ddddbf932745a6be37109b6112d3ee09696106f848449069d3a57bba937ab82e"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"libc", "libc",
"libgit2-sys", "libgit2-sys",
"log", "log",
"url",
] ]
[[package]] [[package]]
@@ -485,9 +484,9 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
version = "0.18.3+1.9.2" version = "0.18.4+1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c9b3acc4b91781bb0b3386669d325163746af5f6e4f73e6d2d630e09a35f3487" checksum = "9b26f66f35e1871b22efcf7191564123d2a446ca0538cde63c23adfefa9b15b7"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
+1 -1
View File
@@ -23,4 +23,4 @@ repository = "https://app.radicle.xyz/nodes/seed.radicle.xyz/rad:z6cFWeWpnZNHh9r
rust-version = "1.78.0" rust-version = "1.78.0"
[workspace.dependencies] [workspace.dependencies]
git2 = { version = "0.20", default-features = false, features = ["vendored-libgit2"] } git2 = { version = "0.21", default-features = false, features = ["vendored-libgit2"] }
+3 -2
View File
@@ -92,8 +92,9 @@ impl<'a> Blob<'a> {
Branch::Ref(reference) => { Branch::Ref(reference) => {
match (reference.target(), reference.symbolic_target()) { match (reference.target(), reference.symbolic_target()) {
(Some(oid), _) => Ok(revwalk::Start::Oid(oid)), (Some(oid), _) => Ok(revwalk::Start::Oid(oid)),
(_, Some(sym)) => Ok(revwalk::Start::Ref(sym.to_string())), (_, Ok(Some(sym))) => Ok(revwalk::Start::Ref(sym.to_string())),
(_, _) => Err(Error::NotFound(NotFound::NoRefTarget)), (_, Ok(None)) => Err(Error::NotFound(NotFound::NoRefTarget)),
(_, Err(err)) => Err(Error::Git(err)),
} }
} }
}?; }?;
+4 -1
View File
@@ -276,7 +276,10 @@ impl TryFrom<git2::Buf> for Commit {
type Error = error::Parse; type Error = error::Parse;
fn try_from(value: git2::Buf) -> Result<Self, Self::Error> { fn try_from(value: git2::Buf) -> Result<Self, Self::Error> {
value.as_str().ok_or(error::Parse::InvalidFormat)?.parse() value
.as_str()
.map_err(|_| error::Parse::InvalidFormat)?
.parse()
} }
} }
+1 -1
View File
@@ -12,5 +12,5 @@ pub fn gen_oid(kind: git2::ObjectType) -> impl Strategy<Value = Oid> {
/// of the type indicated in parameter `kind` or a zeroed `Oid` with /// of the type indicated in parameter `kind` or a zeroed `Oid` with
/// equal probability /// equal probability
pub fn gen_oid_with_zero(kind: git2::ObjectType) -> impl Strategy<Value = Oid> { pub fn gen_oid_with_zero(kind: git2::ObjectType) -> impl Strategy<Value = Oid> {
prop_oneof![gen_oid(kind), Just(git2::Oid::zero().into()),] prop_oneof![gen_oid(kind), Just(git2::Oid::ZERO_SHA1.into()),]
} }
+4 -1
View File
@@ -269,7 +269,10 @@ impl Entry {
path: PathBuf, path: PathBuf,
repo: &Repository, repo: &Repository,
) -> Result<Self, error::Directory> { ) -> Result<Self, error::Directory> {
let name = entry.name().ok_or(error::Directory::Utf8Error)?.to_string(); let name = entry
.name()
.map_err(|_| error::Directory::Utf8Error)?
.to_string();
let id = entry.id().into(); let id = entry.id().into();
match entry.kind() { match entry.kind() {