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

Function finish_graph_stream_with_guard

atomic-cli/src/commands/git/stream.rs:982–1011  ·  view source on GitHub ↗
(
    session: GitGraphImportSession<'_>,
    git: &GitRepository,
    policy: &ConversionPolicy,
    tip: Oid,
    guard: F,
)

Source from the content-addressed store, hash-verified

980}
981
982fn finish_graph_stream_with_guard<F>(
983 session: GitGraphImportSession<'_>,
984 git: &GitRepository,
985 policy: &ConversionPolicy,
986 tip: Oid,
987 guard: F,
988) -> CliResult<GitStreamOutcome>
989where
990 F: FnOnce() -> Result<(), atomic_repository::RepositoryError>,
991{
992 let tree = git
993 .find_commit(tip)
994 .and_then(|commit| commit.tree())
995 .map_err(|e| git_error(e.to_string()))?;
996 let entries = repository_entries_from_git_tree(git, tree.clone(), policy)?;
997 let manifest = RepositoryManifest::new(
998 SetId::ZERO,
999 policy.root().content_key,
1000 entries.into_values().collect(),
1001 )
1002 .map_err(|error| git_error(error.to_string()))?;
1003 let project = ProjectTree::from_manifest(manifest, policy)
1004 .map_err(|error| git_error(error.to_string()))?;
1005 let expected = import_expected_tree_oid(git, tree.id(), policy)?;
1006 let proof = verify_prospective_equivalence(&project, &expected)
1007 .map_err(|error| git_error(error.to_string()))?;
1008 session
1009 .finish_with_guard(&project, &proof, guard)
1010 .map_err(CliError::from)
1011}
1012
1013#[cfg(test)]
1014mod tests {

Callers 2

finish_graph_streamFunction · 0.85

Calls 10

import_expected_tree_oidFunction · 0.85
treeMethod · 0.80
finish_with_guardMethod · 0.80
git_errorFunction · 0.70
cloneMethod · 0.45
rootMethod · 0.45
collectMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected