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

Function walk

atomic-cli/tests/provenance_integration_test.rs:76–88  ·  view source on GitHub ↗
(dir: &Path, base: &Path, set: &mut BTreeSet<String>)

Source from the content-addressed store, hash-verified

74fn snapshot_files(root: &Path) -> BTreeSet<String> {
75 let mut set = BTreeSet::new();
76 fn walk(dir: &Path, base: &Path, set: &mut BTreeSet<String>) {
77 let Ok(entries) = std::fs::read_dir(dir) else {
78 return;
79 };
80 for entry in entries.flatten() {
81 let path = entry.path();
82 if path.is_dir() {
83 walk(&path, base, set);
84 } else if let Ok(rel) = path.strip_prefix(base) {
85 set.insert(rel.to_string_lossy().to_string());
86 }
87 }
88 }
89 walk(root, root, &mut set);
90 set
91}

Callers 3

snapshot_filesFunction · 0.70
walkMethod · 0.50

Calls 3

is_dirMethod · 0.80
pathMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected