MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / validate_canonical_hashes

Function validate_canonical_hashes

atomic-core/src/change/classification.rs:298–311  ·  view source on GitHub ↗
(
    field: &'static str,
    hashes: &[Hash],
)

Source from the content-addressed store, hash-verified

296}
297
298pub(crate) fn validate_canonical_hashes(
299 field: &'static str,
300 hashes: &[Hash],
301) -> Result<(), ChangeValidationError> {
302 for (index, hash) in hashes.iter().enumerate() {
303 if *hash == Hash::NONE {
304 return Err(ChangeValidationError::ZeroHash { field, index });
305 }
306 if index > 0 && hashes[index - 1] >= *hash {
307 return Err(ChangeValidationError::NonCanonicalHashOrder { field, index });
308 }
309 }
310 Ok(())
311}
312
313fn validate_git_algorithms(
314 origin: &'static str,

Callers 4

newMethod · 0.85
validateMethod · 0.85
validate_v2Method · 0.85
decode_change_header_v2Function · 0.85

Calls 1

iterMethod · 0.45

Tested by

no test coverage detected