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:
parent
f41f092778
commit
b2f9ca61d5
|
|
@ -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(())
|
||||
}
|
||||
Loading…
Reference in New Issue