mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 18:40:39 +08:00
tools: Add tool to set canonical refs
It's possible to delete these refs, or for old repos not to have them.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
Reference in New Issue
Block a user