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

Method differences

atomic-cli/tests/it/git_guard_cb0c_test.rs:160–186  ·  view source on GitHub ↗
(&self, actual: &Self)

Source from the content-addressed store, hash-verified

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
189fn collect_map_differences(

Callers

nothing calls this directly

Calls 4

truncateMethod · 0.80
collect_map_differencesFunction · 0.70
pushMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected