radicle_fetch/git.rs
1pub(crate) mod mem;
2pub(crate) mod packfile;
3pub(crate) mod repository;
4
5pub mod refs;
6
7pub(crate) mod oid {
8 //! Helper functions for converting to/from [`radicle::git::Oid`] and
9 //! [`ObjectId`].
10
11 use gix_hash::ObjectId;
12 use radicle::git::Oid;
13
14 /// Convert from an [`ObjectId`] to an [`Oid`].
15 pub fn to_oid(oid: ObjectId) -> Oid {
16 Oid::try_from(oid.as_bytes()).expect("invalid gix Oid")
17 }
18
19 /// Convert from an [`Oid`] to an [`ObjectId`].
20 pub fn to_object_id(oid: Oid) -> ObjectId {
21 ObjectId::from(gix_hash::oid::from_bytes_unchecked(oid.as_ref()))
22 }
23}