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

Function walk

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

Source from the content-addressed store, hash-verified

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

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