Function
validate_git_algorithms
(
origin: &'static str,
primary: &GitObjectId,
parents: &[GitObjectId],
)
Source from the content-addressed store, hash-verified
| 311 | } |
| 312 | |
| 313 | fn validate_git_algorithms( |
| 314 | origin: &'static str, |
| 315 | primary: &GitObjectId, |
| 316 | parents: &[GitObjectId], |
| 317 | ) -> Result<(), ChangeValidationError> { |
| 318 | let expected = primary.algorithm(); |
| 319 | for (parent_index, parent) in parents.iter().enumerate() { |
| 320 | let actual = parent.algorithm(); |
| 321 | if actual != expected { |
| 322 | return Err(ChangeValidationError::MixedGitHashAlgorithms { |
| 323 | origin, |
| 324 | parent_index, |
| 325 | expected, |
| 326 | actual, |
| 327 | }); |
| 328 | } |
| 329 | } |
| 330 | Ok(()) |
| 331 | } |
| 332 | |
| 333 | #[cfg(test)] |
| 334 | mod tests { |
Tested by
no test coverage detected