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

Function standalone_git_ancestry

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

The complete lowercase-hex Git ancestry of `sha` (the commit itself and every transitive parent), walked on the live object database. Used by the bound-range containment probe to skip ancestors, whose content is trivially contained in any descendant.

(git: &GitRepository, sha: &str)

Source from the content-addressed store, hash-verified

1089/// bound-range containment probe to skip ancestors, whose content is
1090/// trivially contained in any descendant.
1091fn standalone_git_ancestry(git: &GitRepository, sha: &str) -> CliResult<HashSet<String>> {
1092 let oid = git2::Oid::from_str(sha)
1093 .map_err(|e| git_error(format!("cannot parse commit oid '{sha}': {e}")))?;
1094 let commit = git.find_commit(oid).map_err(|e| CliError::GitError {
1095 message: format!("cannot read commit {sha} for ancestry: {e}"),
1096 })?;
1097 let mut set: HashSet<String> = HashSet::new();
1098 set.insert(sha.to_ascii_lowercase());
1099 for parent in commit.parent_ids() {
1100 set.extend(standalone_git_ancestry(git, &parent.to_string())?);
1101 }
1102 Ok(set)
1103}
1104
1105/// The tree of commit `sha`, or `None` when it is not locally readable.
1106fn commit_tree_of<'r>(git: &'r GitRepository, sha: &str) -> Option<git2::Tree<'r>> {

Callers

nothing calls this directly

Calls 3

extendMethod · 0.80
git_errorFunction · 0.70
insertMethod · 0.45

Tested by

no test coverage detected