(tree: &git2::Tree, target: &Path)
| 234 | } |
| 235 | |
| 236 | fn 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…