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

Function atomic_manifest

atomic-cli/tests/it/status_git_cb11a_test.rs:880–898  ·  view source on GitHub ↗

Atomic-directory manifest: every relative path with its exact bytes. CB-13A R2 uses this to prove shim verify is a read-only diagnostic — the manifest must be byte-identical across a verify invocation, even on a repository whose operation head is still incomplete.

(root: &Path)

Source from the content-addressed store, hash-verified

878/// the manifest must be byte-identical across a verify invocation, even on
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
898}
899
900/// CB-13A R2: shim verify is a read-only diagnostic. Around a switch that
901/// was interrupted mid-effect (the switch's own error path synchronously

Calls 1

walkFunction · 0.70

Tested by

no test coverage detected