diff --git a/radicle-cob/src/lib.rs b/radicle-cob/src/lib.rs index d7068095..83e8319a 100644 --- a/radicle-cob/src/lib.rs +++ b/radicle-cob/src/lib.rs @@ -77,7 +77,7 @@ mod change_graph; mod trailers; pub mod change; -pub use change::store::{Contents, Embed, Manifest, Version}; +pub use change::store::{Contents, Embed, EntryId, Manifest, Version}; pub use change::Entry; pub mod history; diff --git a/radicle-cob/src/object/collaboration/create.rs b/radicle-cob/src/object/collaboration/create.rs index 9e0f5c8e..9f8db102 100644 --- a/radicle-cob/src/object/collaboration/create.rs +++ b/radicle-cob/src/object/collaboration/create.rs @@ -71,7 +71,7 @@ where let object_id = init_change.id().into(); storage - .update(identifier, &type_name, &object_id, &init_change) + .update(identifier, &type_name, &object_id, &init_change.id) .map_err(|err| error::Create::Refs { err: Box::new(err) })?; let history = History::new_from_root(init_change); diff --git a/radicle-cob/src/object/collaboration/update.rs b/radicle-cob/src/object/collaboration/update.rs index a4d98da8..6662f956 100644 --- a/radicle-cob/src/object/collaboration/update.rs +++ b/radicle-cob/src/object/collaboration/update.rs @@ -96,7 +96,7 @@ where )?; storage - .update(identifier, typename, &object_id, &change) + .update(identifier, typename, &object_id, &change.id) .map_err(|err| error::Update::Refs { err: Box::new(err) })?; let parents = change.parents.to_vec(); diff --git a/radicle-cob/src/object/storage.rs b/radicle-cob/src/object/storage.rs index 5ddb3fad..9a6dfe38 100644 --- a/radicle-cob/src/object/storage.rs +++ b/radicle-cob/src/object/storage.rs @@ -5,7 +5,7 @@ use std::{collections::BTreeMap, error::Error}; use git_ext::ref_format::RefString; use git_ext::Oid; -use crate::change::Entry; +use crate::change::EntryId; use crate::{ObjectId, TypeName}; /// The [`Reference`]s that refer to the commits that make up a @@ -78,7 +78,7 @@ pub trait Storage { identifier: &Self::Identifier, typename: &TypeName, object_id: &ObjectId, - change: &Entry, + entry: &EntryId, ) -> Result<(), Self::UpdateError>; /// Remove a ref to a particular collaborative object diff --git a/radicle-cob/src/test/storage.rs b/radicle-cob/src/test/storage.rs index 43b4fd8e..32c3b4fd 100644 --- a/radicle-cob/src/test/storage.rs +++ b/radicle-cob/src/test/storage.rs @@ -154,7 +154,7 @@ impl object::Storage for Storage { identifier: &Self::Identifier, typename: &crate::TypeName, object_id: &ObjectId, - change: &change::Entry, + entry: &change::EntryId, ) -> Result<(), Self::UpdateError> { let name = format!( "refs/rad/{}/cobs/{}/{}", @@ -162,8 +162,8 @@ impl object::Storage for Storage { typename, object_id ); - let id = *change.id(); - self.raw.reference(&name, id.into(), true, "new change")?; + self.raw + .reference(&name, (*entry).into(), true, "new change")?; Ok(()) } diff --git a/radicle/src/storage/git/cob.rs b/radicle/src/storage/git/cob.rs index 7a1858c5..29859c84 100644 --- a/radicle/src/storage/git/cob.rs +++ b/radicle/src/storage/git/cob.rs @@ -139,17 +139,15 @@ impl cob::object::Storage for Repository { identifier: &Self::Identifier, typename: &cob::TypeName, object_id: &cob::ObjectId, - change: &cob::Entry, + entry: &cob::EntryId, ) -> Result<(), Self::UpdateError> { self.backend.reference( git::refs::storage::cob(identifier, typename, object_id).as_str(), - (*change.id()).into(), + (*entry).into(), true, &format!( - "Updating collaborative object '{}/{}' with new change {}", - typename, - object_id, - change.id() + "Updating collaborative object '{}/{}' with new entry {}", + typename, object_id, entry, ), )?; @@ -387,17 +385,15 @@ impl<'a> cob::object::Storage for DraftStore<'a> { identifier: &Self::Identifier, typename: &cob::TypeName, object_id: &cob::ObjectId, - change: &cob::Entry, + entry: &cob::history::EntryId, ) -> Result<(), Self::UpdateError> { self.repo.backend.reference( git::refs::storage::draft::cob(identifier, typename, object_id).as_str(), - (*change.id()).into(), + (*entry).into(), true, &format!( - "Updating draft collaborative object '{}/{}' with new change {}", - typename, - object_id, - change.id() + "Updating draft collaborative object '{}/{}' with new entry {}", + typename, object_id, entry, ), )?;