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

Function snapshot

atomic-cli/tests/it/adaptation_regression_test.rs:275–290  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

273fn remove_preview_does_not_capture_pending_shim_edits() {
274 use std::collections::BTreeMap;
275 fn snapshot(root: &Path) -> BTreeMap<std::path::PathBuf, Vec<u8>> {
276 fn visit(path: &Path, files: &mut BTreeMap<std::path::PathBuf, Vec<u8>>) {
277 if path.is_dir() {
278 for entry in fs::read_dir(path).unwrap() {
279 visit(&entry.unwrap().path(), files);
280 }
281 } else if path.is_file() {
282 files.insert(path.to_path_buf(), fs::read(path).unwrap());
283 }
284 }
285 let mut files = BTreeMap::new();
286 for path in ["atomic.redb", "changes", "bridge", "deferred-tree-ops.json"] {
287 visit(&root.join(".atomic").join(path), &mut files);
288 }
289 files
290 }
291 let root = tempfile::tempdir().unwrap();
292 {
293 let git = git2::Repository::init(root.path()).unwrap();

Calls 1

visitFunction · 0.70

Tested by

no test coverage detected