MCPcopy Create free account
hub / github.com/AIScientists-Dev/Flowtrace / tree_contains_path

Function tree_contains_path

crates/flowtrace-cli/src/git.rs:236–250  ·  view source on GitHub ↗
(tree: &git2::Tree, target: &Path)

Source from the content-addressed store, hash-verified

234}
235
236fn tree_contains_path(tree: &git2::Tree, target: &Path) -> Result<bool> {
237 let mut found = false;
238 tree.walk(git2::TreeWalkMode::PreOrder, |dir, entry| {
239 let mut p = PathBuf::from(dir);
240 if let Some(name) = entry.name() {
241 p.push(name);
242 }
243 if p == target || p.starts_with(target) {
244 found = true;
245 return git2::TreeWalkResult::Abort;
246 }
247 git2::TreeWalkResult::Ok
248 })?;
249 Ok(found)
250}
251
252/// Locate a subtree by trace-relative path inside the tree at `sha` and run
253/// `f` against it. Returns `Ok(missing)` when the path isn't there (or isn't

Callers 1

commits_underFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…