(context: &str, report: &EquivalenceReport)
| 2137 | } |
| 2138 | |
| 2139 | pub(crate) fn equivalence_error(context: &str, report: &EquivalenceReport) -> CliError { |
| 2140 | let detail = report |
| 2141 | .mismatches |
| 2142 | .iter() |
| 2143 | .map(|mismatch| { |
| 2144 | let path = mismatch |
| 2145 | .path |
| 2146 | .as_ref() |
| 2147 | .map(|path| path.escaped()) |
| 2148 | .unwrap_or_else(|| "<repository>".to_string()); |
| 2149 | format!( |
| 2150 | "{:?}/{:?} {}: expected {}, actual {}", |
| 2151 | mismatch.layer, mismatch.kind, path, mismatch.expected, mismatch.actual |
| 2152 | ) |
| 2153 | }) |
| 2154 | .collect::<Vec<_>>() |
| 2155 | .join("; "); |
| 2156 | git_error(format!("{context} failed complete equivalence: {detail}")) |
| 2157 | } |
| 2158 | |
| 2159 | fn git_error(message: impl Into<String>) -> CliError { |
| 2160 | CliError::GitError { |
no test coverage detected