Skip to content

Commit 70a1d9f

Browse files
committed
adapt to changes in gix-object (Find::try_header())
1 parent d83de61 commit 70a1d9f

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

gix-odb/src/store_impls/dynamic/find.rs

+20-3
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub use error::Error;
7878
use gix_features::zlib;
7979

8080
use crate::store::types::PackId;
81-
use gix_object::{Exists, Find};
8281

8382
impl<S> super::Handle<S>
8483
where
@@ -499,7 +498,7 @@ where
499498
}
500499
}
501500

502-
impl<S> Find for super::Handle<S>
501+
impl<S> gix_object::Find for super::Handle<S>
503502
where
504503
S: Deref<Target = super::Store> + Clone,
505504
Self: gix_pack::Find,
@@ -513,7 +512,25 @@ where
513512
}
514513
}
515514

516-
impl<S> Exists for super::Handle<S>
515+
impl<S> gix_object::FindHeader for super::Handle<S>
516+
where
517+
S: Deref<Target = super::Store> + Clone,
518+
{
519+
fn try_header(&self, id: &gix_hash::oid) -> Result<Option<gix_object::Header>, gix_object::find::Error> {
520+
let mut snapshot = self.snapshot.borrow_mut();
521+
let mut inflate = self.inflate.borrow_mut();
522+
self.try_header_inner(id, &mut inflate, &mut snapshot, None)
523+
.map(|maybe_header| {
524+
maybe_header.map(|hdr| gix_object::Header {
525+
kind: hdr.kind(),
526+
size: hdr.size(),
527+
})
528+
})
529+
.map_err(|err| Box::new(err) as _)
530+
}
531+
}
532+
533+
impl<S> gix_object::Exists for super::Handle<S>
517534
where
518535
S: Deref<Target = super::Store> + Clone,
519536
Self: gix_pack::Find,

gix-odb/src/store_impls/dynamic/header.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl<S> super::Handle<S>
1313
where
1414
S: Deref<Target = super::Store> + Clone,
1515
{
16-
fn try_header_inner<'b>(
16+
pub(crate) fn try_header_inner<'b>(
1717
&'b self,
1818
mut id: &'b gix_hash::oid,
1919
inflate: &mut zlib::Inflate,

0 commit comments

Comments
 (0)