The complete interpreted closure of one Git commit (CB-9B review R1): every Atomic change whose content makes up the commit's interpreted state. The persisted row written at import time is authoritative across runs, bindings, and views; without one, the closure is reconstructed from the checked SHA index plus the change's registered dependency closure (legacy imports). Both paths are exact; a comm
(
&mut self,
repo: &Repository,
git: &GitRepository,
sha: &str,
)
| 862 | /// that can neither be read from the row nor from the index contributes |
| 863 | /// an empty closure and is traced. |
| 864 | fn interpreted_closure( |
| 865 | &mut self, |
| 866 | repo: &Repository, |
| 867 | git: &GitRepository, |
| 868 | sha: &str, |
| 869 | ) -> CliResult<std::sync::Arc<HashSet<ContentHash>>> { |
| 870 | if let Some(cached) = self.closures.get(sha) { |
| 871 | return Ok(cached.clone()); |
| 872 | } |
| 873 | let mut closure: HashSet<ContentHash> = HashSet::new(); |
| 874 | if let Some(persisted) = repo |
| 875 | .git_commit_closure(sha) |
| 876 | .map_err(|e| CliError::Internal(e.into()))? |
| 877 | { |
| 878 | trace_git_import(format!( |
| 879 | "closure {sha}: persisted {} hash(es)", |
| 880 | persisted.len() |
| 881 | )); |
| 882 | closure.extend(persisted); |
| 883 | } else if let Some(hash) = repo |
| 884 | .checked_git_sha(sha) |
| 885 | .map_err(|e| CliError::Internal(e.into()))? |
| 886 | { |
| 887 | for dep in repo |
| 888 | .change_dependency_closure(&hash) |
| 889 | .map_err(|e| CliError::Internal(e.into()))? |
| 890 | { |
| 891 | closure.insert(dep); |
| 892 | } |
| 893 | } |
| 894 | // The interpreted closure is the union of the parents' closures plus |
| 895 | // this commit's own: derive it from the Git ancestry so an |
| 896 | // unrecorded commit still reconstructs exactly. |
| 897 | for member in self.ancestry_of(git, sha)?.iter() { |
| 898 | if member == sha { |
| 899 | continue; |
| 900 | } |
| 901 | let parent_closure = self.interpreted_closure(repo, git, member)?; |
| 902 | closure.extend(parent_closure.iter().copied()); |
| 903 | } |
| 904 | if let Some(own) = repo |
| 905 | .checked_git_sha(sha) |
| 906 | .map_err(|e| CliError::Internal(e.into()))? |
| 907 | { |
| 908 | closure.insert(own); |
| 909 | } |
| 910 | let shared = std::sync::Arc::new(closure); |
| 911 | self.closures.insert(sha.to_string(), shared.clone()); |
| 912 | Ok(shared) |
| 913 | } |
| 914 | |
| 915 | /// Full-chain view membership with Git origins, loaded once per run and |
| 916 | /// refreshed with this run's introductions. |
no test coverage detected