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

Function walkdir_all

atomic-cli/tests/it/git_import_cb9c_test.rs:227–249  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

225/// Deterministic recursive listing of a directory tree.
226#[allow(dead_code)]
227fn walkdir_all(root: &Path) -> Vec<PathBuf> {
228 let mut out = Vec::new();
229 let stack = vec![root.to_path_buf()];
230 let mut queue = std::collections::VecDeque::from(stack);
231 while let Some(dir) = queue.pop_front() {
232 let Ok(read) = fs::read_dir(&dir) else {
233 continue;
234 };
235 let mut children: Vec<PathBuf> = read
236 .filter_map(|entry| entry.ok())
237 .map(|entry| entry.path())
238 .collect();
239 children.sort();
240 for child in children {
241 if child.is_dir() {
242 queue.push_back(child.clone());
243 }
244 out.push(child);
245 }
246 }
247 out.sort();
248 out
249}
250
251/// The CB-9C fidelity corpus: one Git repository whose commit chain walks
252/// every supported tree representation. Each commit's tree is verified

Callers 1

digest_populated_shelvesFunction · 0.85

Calls 7

sortMethod · 0.80
is_dirMethod · 0.80
collectMethod · 0.45
okMethod · 0.45
pathMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected