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

Function walk

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

Source from the content-addressed store, hash-verified

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

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