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 oid != signed_oid {
|
||||
validations.push(Validation::MismatchedRef {
|
||||
remote: remote.id(),
|
||||
refname,
|
||||
expected: signed_oid,
|
||||
actual: oid,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue