diff --git a/radicle-tools/Cargo.toml b/radicle-tools/Cargo.toml index 43c21678..f35b9916 100644 --- a/radicle-tools/Cargo.toml +++ b/radicle-tools/Cargo.toml @@ -29,6 +29,10 @@ path = "src/rad-auth.rs" name = "rad-self" path = "src/rad-self.rs" +[[bin]] +name = "rad-set-canonical-refs" +path = "src/rad-set-canonical-refs.rs" + [[bin]] name = "rad-push" path = "src/rad-push.rs" diff --git a/radicle-tools/src/rad-set-canonical-refs.rs b/radicle-tools/src/rad-set-canonical-refs.rs new file mode 100644 index 00000000..34c38513 --- /dev/null +++ b/radicle-tools/src/rad-set-canonical-refs.rs @@ -0,0 +1,21 @@ +use std::path::Path; + +use radicle::{ + storage::{WriteRepository, WriteStorage}, + Profile, +}; + +fn main() -> anyhow::Result<()> { + let profile = Profile::load()?; + + let (_, rid) = radicle::rad::repo(Path::new("."))?; + let repo = profile.storage.repository_mut(rid)?; + + let id_oid = repo.set_identity_head()?; + let branch_oid = repo.set_head()?; + + println!("ok: identity: {id_oid}"); + println!("ok: branch: {branch_oid}"); + + Ok(()) +}