| |
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;
|
| |
///
|
| |
/// 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,
|