(dir: &Path, prefix: &str, out: &mut BTreeMap<String, Vec<u8>>)
| 879 | /// a repository whose operation head is still incomplete. |
| 880 | fn 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 |
no test coverage detected