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

Function checkpoints_semantically_equal

atomic-agent/src/record/mod.rs:279–295  ·  view source on GitHub ↗

Semantic checkpoint equality (review R5). The raw index digest is evidence, not semantics: a stat-only index refresh changes the file bytes (and its digest) without changing the represented tree. When both sides observed an index tree, tree equality proves the index semantically unchanged even if the digest drifted. A digest drift without a readable tree stays INEQUALITY (uncertainty is never equ

(
    start: &GitBoundaryCheckpoint,
    end: &GitBoundaryCheckpoint,
)

Source from the content-addressed store, hash-verified

277/// index semantically unchanged even if the digest drifted. A digest drift
278/// without a readable tree stays INEQUALITY (uncertainty is never equality).
279fn checkpoints_semantically_equal(
280 start: &GitBoundaryCheckpoint,
281 end: &GitBoundaryCheckpoint,
282) -> bool {
283 let index_equal = match (&start.index_digest, &end.index_digest) {
284 (Some(a), Some(b)) if a == b => true,
285 (Some(_), Some(_)) => start.index_tree.is_some() && end.index_tree.is_some(),
286 _ => start.index_digest == end.index_digest,
287 };
288 start.head_oid == end.head_oid
289 && start.head_symref == end.head_symref
290 && start.head_tree == end.head_tree
291 && start.index_tree == end.index_tree
292 && index_equal
293 && start.repository_state == end.repository_state
294 && start.markers == end.markers
295}
296
297/// Whether the observed HEAD move is explained by an anchored journal record.
298///

Callers 3

projection_journaledFunction · 0.85
classify_clean_turnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected