MCPcopy Create free account
hub / github.com/f0rr0/oliphaunt / is_git_ancestor

Function is_git_ancestor

xtask/src/main.rs:6728–6739  ·  view source on GitHub ↗
(checkout: &Path, commit: &str)

Source from the content-addressed store, hash-verified

6726}
6727
6728fn is_git_ancestor(checkout: &Path, commit: &str) -> Result<bool> {
6729 let status = Command::new("git")
6730 .args(["merge-base", "--is-ancestor", commit, "HEAD"])
6731 .current_dir(checkout)
6732 .status()
6733 .with_context(|| format!("check whether {commit} is in {}", checkout.display()))?;
6734 match status.code() {
6735 Some(0) => Ok(true),
6736 Some(1) => Ok(false),
6737 _ => bail!("git merge-base failed for {commit} with {status}"),
6738 }
6739}
6740
6741fn check_all_manifest_source_checkouts(
6742 manifest: &SourcesManifest,

Callers 1

audit_upstream_fixesFunction · 0.85

Calls 2

statusMethod · 0.80
argsMethod · 0.80

Tested by

no test coverage detected