Resolve one raw change reference with the local insert bodies' semantics: a full base32 hash parses directly; otherwise a case-insensitive unique prefix over the change store, refusing with the local messages on no match / ambiguity.
(
repo: &Repository,
reference: &str,
)
| 1088 | /// case-insensitive unique prefix over the change store, refusing with |
| 1089 | /// the local messages on no match / ambiguity. |
| 1090 | fn resolve_change_reference( |
| 1091 | repo: &Repository, |
| 1092 | reference: &str, |
| 1093 | ) -> Result<atomic_core::types::Merkle, Status> { |
| 1094 | use atomic_core::types::Base32; |
| 1095 | if let Some(hash) = atomic_core::types::Merkle::from_base32(reference.as_bytes()) { |
| 1096 | return Ok(hash); |
| 1097 | } |
| 1098 | if reference.len() >= 2 { |
| 1099 | match repo.find_change_by_prefix(reference) { |
| 1100 | Ok(Some(hash)) => return Ok(hash), |
| 1101 | Ok(None) => {} |
| 1102 | Err(atomic_repository::RepositoryError::AmbiguousHash { .. }) => { |
| 1103 | return Err(domain_status( |
| 1104 | ErrorCode::NotFound, |
| 1105 | format!("Ambiguous change hash '{reference}' - matches multiple changes"), |
| 1106 | )); |
| 1107 | } |
| 1108 | Err(error) => return Err(repository_error(error)), |
| 1109 | } |
| 1110 | } |
| 1111 | Err(domain_status( |
| 1112 | ErrorCode::NotFound, |
| 1113 | format!("Change not found: {reference}"), |
| 1114 | )) |
| 1115 | } |
| 1116 | |
| 1117 | /// The single-insert domain calls the local single-insert body makes: |
| 1118 | /// the dependency closure by default, `--deps=false` skips it (the |
no test coverage detected