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

Method exclusions_for

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

Changes in `target_view` (full ancestor chain included) that are NOT part of `sha`'s interpreted closure — the sibling lineages that must stay invisible while assembling `sha` (review R1). A member is excluded only when its own unhashed provenance names a Git commit outside `sha`'s ancestry and the member is not part of any persisted/reconstructed ancestor closure. Non-Git members (native Atomic

(
        &mut self,
        repo: &Repository,
        git: &GitRepository,
        sha: &str,
        target_view: &str,
        has_git_parent: bool,
    )

Source from the content-addressed store, hash-verified

942 /// genuinely replaced history — and may leave the view — is decided by
943 /// [`ClosureLedger::supersede_exclusions_for`].
944 fn exclusions_for(
945 &mut self,
946 repo: &Repository,
947 git: &GitRepository,
948 sha: &str,
949 target_view: &str,
950 has_git_parent: bool,
951 ) -> CliResult<Vec<ContentHash>> {
952 if !has_git_parent {
953 // A root commit has no Git parent closure to assemble against:
954 // its tree replaces the view state, so the whole view is the
955 // assembly context and nothing is excluded. Bound paths with
956 // different content record as state replacements (rewritten
957 // history), which is the sanctioned foreign-interpretation path.
958 return Ok(Vec::new());
959 }
960 let ancestry = self.ancestry_of(git, sha)?;
961 let closure = self.interpreted_closure(repo, git, sha)?;
962 trace_git_import(format!(
963 "exclusions {sha}: ancestry={} closure={}",
964 ancestry.len(),
965 closure.len()
966 ));
967 let mut exclusions: Vec<ContentHash> = Vec::new();
968 for (hash, origin_sha) in self.origins_for(repo, target_view)? {
969 if closure.contains(&hash) {
970 continue;
971 }
972 if let Some(origin_sha) = &origin_sha {
973 if !ancestry.contains(origin_sha.as_str()) {
974 exclusions.push(hash);
975 }
976 }
977 }
978 Ok(exclusions)
979 }
980
981 /// The genuinely replaced history among `sha`'s assembly exclusions:
982 /// excluded view members whose Git origin is ALSO outside this import's

Calls 7

trace_git_importFunction · 0.85
ancestry_ofMethod · 0.80
interpreted_closureMethod · 0.80
origins_forMethod · 0.80
containsMethod · 0.45
as_strMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected