Explain Atomic's own projection only through verified operation receipts after the captured working-copy head. Reflog messages and commit metadata are not authority. Every Git transition must form an exact before/after chain, so a foreign commit mixed into the turn remains unexplained.
(
repo: &atomic_repository::Repository,
options: &TurnRecordOptions<'_>,
start: &GitBoundaryCheckpoint,
end: &GitBoundaryCheckpoint,
)
| 375 | /// are not authority. Every Git transition must form an exact before/after |
| 376 | /// chain, so a foreign commit mixed into the turn remains unexplained. |
| 377 | fn projection_journaled( |
| 378 | repo: &atomic_repository::Repository, |
| 379 | options: &TurnRecordOptions<'_>, |
| 380 | start: &GitBoundaryCheckpoint, |
| 381 | end: &GitBoundaryCheckpoint, |
| 382 | ) -> bool { |
| 383 | use atomic_core::operation::{ |
| 384 | ActorRef, EffectTarget, EffectValue, GitHeadState, GitStateRef, OperationKind, |
| 385 | OperationScope, |
| 386 | }; |
| 387 | use atomic_repository::OperationVerificationState; |
| 388 | let Some(boundary) = options.session.boundary_start.as_ref() else { |
| 389 | return false; |
| 390 | }; |
| 391 | let Some(start_operation) = boundary.operation.as_deref() else { |
| 392 | return false; |
| 393 | }; |
| 394 | let Ok(working_copy) = repo.require_working_copy_id() else { |
| 395 | return false; |
| 396 | }; |
| 397 | if boundary.working_copy != working_copy.to_string() |
| 398 | || start.index_locked |
| 399 | || end.index_locked |
| 400 | || !start.markers.is_empty() |
| 401 | || !end.markers.is_empty() |
| 402 | || start.repository_state != end.repository_state |
| 403 | { |
| 404 | return false; |
| 405 | } |
| 406 | let Ok(log) = repo.operation_log(OperationScope::WorkingCopy(working_copy), None, true) else { |
| 407 | return false; |
| 408 | }; |
| 409 | if !matches!( |
| 410 | log.head_state, |
| 411 | atomic_repository::OperationHeadState::Single(_) |
| 412 | ) { |
| 413 | return false; |
| 414 | } |
| 415 | let Some(start_index) = log |
| 416 | .entries |
| 417 | .iter() |
| 418 | .position(|entry| entry.operation.id().to_string() == start_operation) |
| 419 | else { |
| 420 | return false; |
| 421 | }; |
| 422 | fn checkpoint( |
| 423 | git: &git2::Repository, |
| 424 | state: &GitStateRef, |
| 425 | template: &GitBoundaryCheckpoint, |
| 426 | ) -> Option<GitBoundaryCheckpoint> { |
| 427 | let (oid, symref) = match &state.head { |
| 428 | GitHeadState::Attached { symref, oid } => (oid, Some(symref.clone())), |
| 429 | GitHeadState::Detached { oid } => (oid, None), |
| 430 | _ => return None, |
| 431 | }; |
| 432 | let hex = |oid: &atomic_core::operation::GitObjectId| { |
| 433 | oid.as_bytes() |
| 434 | .iter() |
no test coverage detected