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

Function index_matches_projection

atomic-cli/src/commands/git/shadow.rs:970–987  ·  view source on GitHub ↗

Whether the Git index is a clean stage-0 image of the view's projected tree. Only `StagingState.index_manifest` projects to the index (RFC §3.4); any other index state is user work between boundaries. Intent-to-add and sparse entries are tolerated: their intent (not content) is recorded and the joint comparison resolves them like the CB-4B push gate does.

(
    repo: &Repository,
    repo_root: &Path,
    git_repo: &GitRepository,
    view: &str,
)

Source from the content-addressed store, hash-verified

968/// sparse entries are tolerated: their intent (not content) is recorded and
969/// the joint comparison resolves them like the CB-4B push gate does.
970fn index_matches_projection(
971 repo: &Repository,
972 repo_root: &Path,
973 git_repo: &GitRepository,
974 view: &str,
975) -> bool {
976 let Ok((policy, _filters)) = current_conversion_policy(repo_root, git_repo) else {
977 return false;
978 };
979 let Ok(project) = repo.project_tree(view, &policy) else {
980 return false;
981 };
982 let Ok(index) = observe_git_index(repo_root, &policy) else {
983 return false;
984 };
985 let report = compare_project_to_index(&project, &index);
986 report.mismatches.is_empty()
987}
988
989/// Project one Atomic view into its Git mirror (CB-8A RFC §8.1/§8.2).
990///

Callers

nothing calls this directly

Calls 5

observe_git_indexFunction · 0.85
compare_project_to_indexFunction · 0.85
project_treeMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected