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

Function setup_fixture

atomic-cli/tests/it/git_binding_cb6a_test.rs:58–86  ·  view source on GitHub ↗
(root: &Path, home: &Path)

Source from the content-addressed store, hash-verified

56}
57
58fn setup_fixture(root: &Path, home: &Path) {
59 {
60 let git = git2::Repository::init(root).expect("init Git");
61 fs::write(root.join("tracked.txt"), b"tracked bytes\n").expect("write file");
62 let mut index = git.index().expect("open index");
63 index
64 .add_path(Path::new("tracked.txt"))
65 .expect("stage file");
66 index.write().expect("write index");
67 let tree_oid = index.write_tree().expect("write tree");
68 let tree = git.find_tree(tree_oid).expect("find tree");
69 let signature = git2::Signature::now("Test", "test@example.com").expect("signature");
70 git.commit(Some("HEAD"), &signature, &signature, "initial", &tree, &[])
71 .expect("commit");
72 }
73
74 // Import the Git history into Atomic and anchor the shim baseline.
75 let import = atomic(root, home, &["git", "import", "--no-vault"]);
76 assert_init(&import);
77 let reconcile = atomic(root, home, &["git", "shim", "reconcile"]);
78 assert_init(&reconcile);
79
80 // Create a real recorded edit so a causal operation exists to bind.
81 fs::write(root.join("tracked.txt"), b"tracked bytes\nmore\n").expect("edit file");
82 let add = atomic(root, home, &["add", "tracked.txt"]);
83 assert_init(&add);
84 let record = atomic(root, home, &["record", "-m", "record tracked file"]);
85 assert_init(&record);
86}
87
88fn assert_init(output: &Output) {
89 assert!(

Calls 8

assert_initFunction · 0.85
initFunction · 0.70
writeFunction · 0.70
atomicFunction · 0.70
indexMethod · 0.45
add_pathMethod · 0.45
writeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected