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

Function print_divergence_notices

atomic-cli/src/commands/git/ref_mapping.rs:438–465  ·  view source on GitHub ↗

Surface persisted ref-mapping divergence in `atomic status` (CB-10A AC-2): an actionable Diverged/Unrepresentable warning with explicit insert/merge remediation. Read-only; it never materializes and never moves a ref.

(repo: &Repository)

Source from the content-addressed store, hash-verified

436/// an actionable Diverged/Unrepresentable warning with explicit insert/merge
437/// remediation. Read-only; it never materializes and never moves a ref.
438pub(crate) fn print_divergence_notices(repo: &Repository) -> CliResult<()> {
439 for mapping in repo.list_ref_mappings().map_err(CliError::from)? {
440 let diverged = mapping.status == RefSyncStatus::Diverged;
441 // A deleted-view tombstone is reported by view existence alone; the
442 // persisted local ref (CB-10A review R5: tombstones keep the ref
443 // name) is preserved in the diagnostic instead of being erased.
444 let orphaned = !repo
445 .view_exists(&mapping.view_name)
446 .map_err(CliError::from)?;
447 if diverged {
448 crate::output::print_warning(&format!(
449 "ref mapping for view '{}' is Diverged: Git and Atomic both moved beyond the last \
450 mutually observed mapping; neither side was moved. {}",
451 mapping.view_name,
452 remediation_for(RefSyncStatus::Diverged)
453 ));
454 } else if orphaned {
455 let mapped_ref = mapping.local_ref.as_deref().unwrap_or("<no ref persisted>");
456 crate::output::print_warning(&format!(
457 "ref mapping for deleted view '{}' is Unrepresentable: its Git ref '{mapped_ref}' \
458 was left untouched. {}",
459 mapping.view_name,
460 remediation_for(RefSyncStatus::Unrepresentable)
461 ));
462 }
463 }
464 Ok(())
465}
466
467/// `atomic git shim status`: read-only per-view ref-mapping reconciliation
468/// report (CB-10A AC-2). Never materializes; never moves a ref.

Callers 2

render_service_statusMethod · 0.85
runMethod · 0.85

Calls 3

print_warningFunction · 0.85
list_ref_mappingsMethod · 0.80
view_existsMethod · 0.80

Tested by

no test coverage detected