Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
radicle: Minimize scope of `git2::ext`
Lorenz Leutgeb committed 7 months ago
commit b0df7d409767066f816a9b3e1c056c309bb8a7b5
parent 12b06748ea7647974e45cd9f1695a5a9f1398866
2 files changed +7 -11
modified crates/radicle/src/cob/test.rs
@@ -12,9 +12,6 @@ use crate::cob::store::encoding;
use crate::cob::{patch, Title};
use crate::cob::{Entry, History, Manifest, Timestamp, Version};
use crate::crypto::Signer;
-
use crate::git2::ext::author::Author;
-
use crate::git2::ext::commit::headers::Headers;
-
use crate::git2::ext::commit::{trailers::OwnedTrailer, CommitData};
use crate::node::device::Device;
use crate::prelude::Did;
use crate::profile::env;
@@ -251,19 +248,24 @@ impl<G: Signer> Actor<G> {
///
/// Doesn't encode in the same way as we do in production, but attempts to include the same data
/// that feeds into the hash entropy, so that changing any input will change the resulting oid.
-
pub fn encoded<T: Cob, G: Signer>(
+
fn encoded<T: Cob, G: Signer>(
    action: &T::Action,
    timestamp: Timestamp,
    parents: impl IntoIterator<Item = Oid>,
    signer: &G,
) -> (Vec<u8>, crate::Oid) {
+
    use radicle_git2_metadata::{
+
        author::{Author, Time},
+
        commit::{CommitData, headers::Headers, trailers::OwnedTrailer}
+
    };
+

    let data = encoding::encode(action).unwrap();
    let oid = crate::git2::Oid::hash_object(crate::git2::ObjectType::Blob, &data).unwrap();
    let parents = parents.into_iter().map(|o| o.into());
    let author = Author {
        name: "radicle".to_owned(),
        email: signer.public_key().to_human(),
-
        time: crate::git2::ext::author::Time::new(timestamp.as_secs() as i64, 0),
+
        time: Time::new(timestamp.as_secs() as i64, 0),
    };
    let commit = CommitData::<git2::Oid, git2::Oid>::new::<_, _, OwnedTrailer>(
        oid,
modified crates/radicle/src/git2.rs
@@ -22,12 +22,6 @@ pub mod transport {
    };
}

-
// Implementation-dependent extensions.
-
pub mod ext {
-
    #[cfg(test)]
-
    pub use radicle_git2_metadata::*;
-
}
-

pub trait ErrorExt {
    fn is_not_found(&self) -> bool;
}