(&self, actual: &Self)
| 158 | } |
| 159 | |
| 160 | fn differences(&self, actual: &Self) -> Vec<String> { |
| 161 | const MAX_DIFFERENCES: usize = 32; |
| 162 | |
| 163 | let mut differences = Vec::new(); |
| 164 | collect_map_differences(".atomic", &self.atomic, &actual.atomic, &mut differences); |
| 165 | collect_map_differences(".git", &self.git, &actual.git, &mut differences); |
| 166 | collect_map_differences( |
| 167 | "worktree", |
| 168 | &self.worktree, |
| 169 | &actual.worktree, |
| 170 | &mut differences, |
| 171 | ); |
| 172 | if self.log != actual.log { |
| 173 | differences.push(format!( |
| 174 | "Atomic log changed ({} -> {} bytes)", |
| 175 | self.log.len(), |
| 176 | actual.log.len() |
| 177 | )); |
| 178 | } |
| 179 | |
| 180 | if differences.len() > MAX_DIFFERENCES { |
| 181 | let omitted = differences.len() - MAX_DIFFERENCES; |
| 182 | differences.truncate(MAX_DIFFERENCES); |
| 183 | differences.push(format!("... and {omitted} more differences")); |
| 184 | } |
| 185 | differences |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | fn collect_map_differences( |
nothing calls this directly
no test coverage detected