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

Function walk

atomic-cli/tests/it/status_git_cb11a_test.rs:881–894  ·  view source on GitHub ↗
(dir: &Path, prefix: &str, out: &mut BTreeMap<String, Vec<u8>>)

Source from the content-addressed store, hash-verified

879/// a repository whose operation head is still incomplete.
880fn atomic_manifest(root: &Path) -> BTreeMap<String, Vec<u8>> {
881 fn walk(dir: &Path, prefix: &str, out: &mut BTreeMap<String, Vec<u8>>) {
882 let Ok(entries) = fs::read_dir(dir) else {
883 return;
884 };
885 for entry in entries.flatten() {
886 let path = entry.path();
887 let name = format!("{prefix}/{}", entry.file_name().to_string_lossy());
888 if path.is_dir() {
889 walk(&path, &name, out);
890 } else if let Ok(bytes) = fs::read(&path) {
891 out.insert(name, bytes);
892 }
893 }
894 }
895 let mut out = BTreeMap::new();
896 walk(&root.join(".atomic"), ".atomic", &mut out);
897 out

Callers 3

walkMethod · 0.70
shelved_filesMethod · 0.70
atomic_manifestFunction · 0.70

Calls 4

is_dirMethod · 0.80
readFunction · 0.70
pathMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected