radicle/storage: Improve `Validation` error

`Validation::MismatchedRef` always happens in the context of a remote,
so have it carry the corresponding `RemoteId`.
This commit is contained in:
Lorenz Leutgeb 2026-03-06 14:11:59 +01:00
parent ba9c09facb
commit 0e45347b92
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View File

@ -742,6 +742,7 @@ where
if let Some(signed_oid) = signed.remove(&refname) {
if oid != signed_oid {
validations.push(Validation::MismatchedRef {
remote: remote.id(),
refname,
expected: signed_oid,
actual: oid,

View File

@ -377,11 +377,12 @@ impl DerefMut for Validations {
pub enum Validation {
#[error("found unsigned ref `{0}`")]
UnsignedRef(RefString),
#[error("{refname}: expected {expected}, but found {actual}")]
#[error("expected `refs/namespaces/{remote}/{refname}` at {expected} but found {actual}")]
MismatchedRef {
remote: RemoteId,
refname: RefString,
expected: Oid,
actual: Oid,
refname: RefString,
},
#[error("missing `refs/namespaces/{remote}/{refname}`")]
MissingRef {
@ -648,6 +649,7 @@ impl ValidateRepository for Repository {
if let Some(signed_oid) = signed.remove(&refname) {
if oid != signed_oid {
failures.push(Validation::MismatchedRef {
remote: remote.id(),
refname,
expected: signed_oid,
actual: oid,