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

Method rewrite_evidence_for

atomic-cli/src/commands/git/parallel.rs:7736–7875  ·  view source on GitHub ↗

Collect the rewrite evidence for one parsed commit (CB-9B, review blocker 4). Two independent evidence sources, each with its own identity limit: 1. **Captured post-rewrite events** — journal records whose interpretation matches the advisory post-rewrite contract, whose `new_oid` equals this commit's *full* OID (never a prefix or an empty/partial value), and whose OIDs are full-length hex. Such a

(
        &self,
        repo: &Repository,
        git: &GitRepository,
        parsed: &ParsedCommit,
    )

Source from the content-addressed store, hash-verified

7734 /// not recomputed content-verified; no content or identity claim is
7735 /// made from these hints (RFC §5.4).
7736 fn rewrite_evidence_for(
7737 &self,
7738 repo: &Repository,
7739 git: &GitRepository,
7740 parsed: &ParsedCommit,
7741 ) -> CliResult<Vec<RewriteEvidence>> {
7742 let mut evidence = Vec::new();
7743
7744 // 1. Captured post-rewrite events with exact full-OID linkage.
7745 if let Some((predecessors, event_ids, untrusted, unauthenticated)) =
7746 self.captured_post_rewrite_linkage(repo, &parsed.git_sha)
7747 {
7748 if untrusted > 0 {
7749 trace_git_import(format!(
7750 "rewrite-evidence {}: {untrusted} malformed journal record(s) ignored",
7751 parsed.short_sha
7752 ));
7753 }
7754 if !predecessors.is_empty() {
7755 evidence.push(RewriteEvidence {
7756 class: "post-rewrite-event",
7757 predecessors,
7758 binding_ids: Vec::new(),
7759 event_ids,
7760 });
7761 }
7762 if unauthenticated > 0 {
7763 // The journal text has the advisory shape but no immutable
7764 // captured record backs it: surfaced explicitly as
7765 // untrusted, never as operation linkage (review R4).
7766 evidence.push(RewriteEvidence {
7767 class: "unauthenticated-event",
7768 predecessors: Vec::new(),
7769 binding_ids: Vec::new(),
7770 event_ids: Vec::new(),
7771 });
7772 }
7773 }
7774
7775 // 2. Advisory binding hints, found independently of hooks.
7776 let algorithm = git_algorithm_for_sha(&parsed.git_sha)?;
7777 let tree_hex = tagged_oid_hex(&git_object_id(algorithm, parsed.tree_oid)?);
7778 for id in repo
7779 .binding_ids()
7780 .map_err(|e| CliError::Internal(e.into()))?
7781 {
7782 let Ok(Some(binding)) = repo.load_binding(&id) else {
7783 continue;
7784 };
7785 if atomic_repository::git_binding::verify_binding_cryptography(&binding).is_err() {
7786 continue;
7787 }
7788 let payload = binding.payload();
7789 let Ok(bound_commit) = payload.git_commit.to_git_object_id() else {
7790 continue;
7791 };
7792 let Ok(bound_tree) = payload.git_tree.to_git_object_id() else {
7793 continue;

Callers 1

Calls 13

trace_git_importFunction · 0.85
git_algorithm_for_shaFunction · 0.85
tagged_oid_hexFunction · 0.85
binding_idsMethod · 0.80
load_bindingMethod · 0.80
to_git_object_idMethod · 0.80
git_object_idFunction · 0.70
is_emptyMethod · 0.45
pushMethod · 0.45
payloadMethod · 0.45

Tested by

no test coverage detected