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

Function index_matches_projection

atomic-cli/src/commands/git/shadow.rs:955–972  ·  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

953/// sparse entries are tolerated: their intent (not content) is recorded and
954/// the joint comparison resolves them like the CB-4B push gate does.
955fn index_matches_projection(
956 repo: &Repository,
957 repo_root: &Path,
958 git_repo: &GitRepository,
959 view: &str,
960) -> bool {
961 let Ok((policy, _filters)) = current_conversion_policy(repo_root, git_repo) else {
962 return false;
963 };
964 let Ok(project) = repo.project_tree(view, &policy) else {
965 return false;
966 };
967 let Ok(index) = observe_git_index(repo_root, &policy) else {
968 return false;
969 };
970 let report = compare_project_to_index(&project, &index);
971 report.mismatches.is_empty()
972}
973
974/// Project one Atomic view into its Git mirror (CB-8A RFC §8.1/§8.2).
975///

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