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:
parent
ba9c09facb
commit
0e45347b92
|
|
@ -742,6 +742,7 @@ where
|
||||||
if let Some(signed_oid) = signed.remove(&refname) {
|
if let Some(signed_oid) = signed.remove(&refname) {
|
||||||
if oid != signed_oid {
|
if oid != signed_oid {
|
||||||
validations.push(Validation::MismatchedRef {
|
validations.push(Validation::MismatchedRef {
|
||||||
|
remote: remote.id(),
|
||||||
refname,
|
refname,
|
||||||
expected: signed_oid,
|
expected: signed_oid,
|
||||||
actual: oid,
|
actual: oid,
|
||||||
|
|
|
||||||
|
|
@ -377,11 +377,12 @@ impl DerefMut for Validations {
|
||||||
pub enum Validation {
|
pub enum Validation {
|
||||||
#[error("found unsigned ref `{0}`")]
|
#[error("found unsigned ref `{0}`")]
|
||||||
UnsignedRef(RefString),
|
UnsignedRef(RefString),
|
||||||
#[error("{refname}: expected {expected}, but found {actual}")]
|
#[error("expected `refs/namespaces/{remote}/{refname}` at {expected} but found {actual}")]
|
||||||
MismatchedRef {
|
MismatchedRef {
|
||||||
|
remote: RemoteId,
|
||||||
|
refname: RefString,
|
||||||
expected: Oid,
|
expected: Oid,
|
||||||
actual: Oid,
|
actual: Oid,
|
||||||
refname: RefString,
|
|
||||||
},
|
},
|
||||||
#[error("missing `refs/namespaces/{remote}/{refname}`")]
|
#[error("missing `refs/namespaces/{remote}/{refname}`")]
|
||||||
MissingRef {
|
MissingRef {
|
||||||
|
|
@ -648,6 +649,7 @@ impl ValidateRepository for Repository {
|
||||||
if let Some(signed_oid) = signed.remove(&refname) {
|
if let Some(signed_oid) = signed.remove(&refname) {
|
||||||
if oid != signed_oid {
|
if oid != signed_oid {
|
||||||
failures.push(Validation::MismatchedRef {
|
failures.push(Validation::MismatchedRef {
|
||||||
|
remote: remote.id(),
|
||||||
refname,
|
refname,
|
||||||
expected: signed_oid,
|
expected: signed_oid,
|
||||||
actual: oid,
|
actual: oid,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue