diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f9141a81..cd8709fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,14 @@ We will note that we found an inconsistency where the concurrent operations which is ordered first. Further analysis of the ordering of pairs of actions is required, but is left to future work. +We scanned the network for cases where these changes in evaluation also lead +to changes in the identity document. There are some cases, but this happens +rarely: Out of several thousand repositories, only around fifteen showed +differences. + +In case your repository is affected, you might need to run `rad id cache`. This +re-evaluates the identity COB and updates the `refs/rad/id` reference. + ## Improvements - `rad patch list` includes a `Labels` column, showing any assigned labels to diff --git a/crates/radicle-cli/src/commands/id.rs b/crates/radicle-cli/src/commands/id.rs index a0c7c6694..9ff38f2bb 100644 --- a/crates/radicle-cli/src/commands/id.rs +++ b/crates/radicle-cli/src/commands/id.rs @@ -9,7 +9,7 @@ use radicle::cob::identity::{self, IdentityMut, Revision, RevisionId}; use radicle::identity::doc::update; use radicle::identity::{Doc, Identity, RawDoc, doc}; use radicle::node::NodeId; -use radicle::storage::{ReadStorage as _, WriteRepository}; +use radicle::storage::{ReadRepository as _, ReadStorage as _, WriteRepository}; use radicle::{Profile, cob, crypto}; use radicle_surf::diff::Diff; use radicle_term::Element; @@ -303,6 +303,19 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> { print(revision, previous, &repo, &profile)?; } + Command::Cache { storage: false } => { + set_identity_head(&repo)?; + } + Command::Cache { storage: true } => { + for info in profile.storage.repositories()? { + if let Err(err) = set_identity_head(&profile.storage.repository(info.rid)?) { + term::error(format!( + "Failed to cache identity for repository {}: {err}", + info.rid + )); + } + } + } } Ok(()) } @@ -514,6 +527,12 @@ fn update( } } +fn set_identity_head(repo: &radicle::storage::git::Repository) -> anyhow::Result<()> { + repo.set_identity_head()?; + term::success!("Successfully cached identity of repository {}", repo.id()); + Ok(()) +} + fn on_identity_err(e: identity::Error, profile: &Profile) -> anyhow::Error { let e = anyhow::Error::from(e); diff --git a/crates/radicle-cli/src/commands/id/args.rs b/crates/radicle-cli/src/commands/id/args.rs index 1b5930100..5b248b8da 100644 --- a/crates/radicle-cli/src/commands/id/args.rs +++ b/crates/radicle-cli/src/commands/id/args.rs @@ -241,6 +241,12 @@ pub(super) enum Command { #[arg(value_name = "REVISION_ID")] revision: Rev, }, + + /// Re-cache the identity + Cache { + #[arg(long)] + storage: bool, + }, } #[cfg(test)]