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

Function snapshot_worktree

atomic-cli/tests/it/git_guard_cb0c_test.rs:296–313  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

294}
295
296fn snapshot_worktree(root: &Path) -> BTreeMap<String, Vec<u8>> {
297 let mut snapshot = BTreeMap::new();
298 let mut children: Vec<PathBuf> = fs::read_dir(root)
299 .expect("worktree directory")
300 .map(|entry| entry.expect("worktree entry").path())
301 .filter(|path| {
302 !matches!(
303 path.file_name().and_then(|name| name.to_str()),
304 Some(".atomic" | ".git" | ".vault")
305 )
306 })
307 .collect();
308 children.sort();
309 for child in children {
310 collect_snapshot(root, &child, &mut snapshot);
311 }
312 snapshot
313}
314
315fn latest_change(fixture: &Fixture) -> String {
316 let log: Value = serde_json::from_slice(&fixture.log_json()).expect("Atomic JSON log");

Callers 1

captureMethod · 0.70

Calls 4

sortMethod · 0.80
collect_snapshotFunction · 0.70
collectMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected