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

Function setup_publisher

atomic-cli/tests/it/git_binding_cb6b_test.rs:65–93  ·  view source on GitHub ↗

A publisher: Git repo, imported shim baseline, three recorded changes.

(root: &Path, home: &Path)

Source from the content-addressed store, hash-verified

63
64/// A publisher: Git repo, imported shim baseline, three recorded changes.
65fn setup_publisher(root: &Path, home: &Path) {
66 {
67 let git = git2::Repository::init(root).expect("init git");
68 fs::write(root.join("tracked.txt"), b"tracked bytes\n").expect("write file");
69 let mut index = git.index().expect("open index");
70 index.add_path(Path::new("tracked.txt")).expect("stage");
71 index.write().expect("write index");
72 let tree_oid = index.write_tree().expect("write tree");
73 let tree = git.find_tree(tree_oid).expect("find tree");
74 let signature = git2::Signature::now("Test", "test@example.com").expect("signature");
75 git.commit(Some("HEAD"), &signature, &signature, "initial", &tree, &[])
76 .expect("commit");
77 }
78
79 assert_success(
80 &atomic(root, home, &["git", "import", "--no-vault"]),
81 "git import",
82 );
83 assert_success(
84 &atomic(root, home, &["git", "shim", "reconcile"]),
85 "shim reconcile",
86 );
87
88 for (name, message) in [("a.txt", "one"), ("b.txt", "two"), ("c.txt", "three")] {
89 fs::write(root.join(name), format!("{message}\n")).expect("edit file");
90 assert_success(&atomic(root, home, &["add", name]), "add");
91 assert_success(&atomic(root, home, &["record", "-m", message]), "record");
92 }
93}
94
95fn binding_id(root: &Path, _home: &Path) -> String {
96 let repo = atomic_repository::Repository::open_readonly(root).expect("open atomic");

Calls 8

initFunction · 0.70
writeFunction · 0.70
assert_successFunction · 0.70
atomicFunction · 0.70
indexMethod · 0.45
add_pathMethod · 0.45
writeMethod · 0.45
commitMethod · 0.45

Tested by

no test coverage detected