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

Method new

atomic-cli/tests/it/git_adoption_cb7b_test.rs:110–155  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

108
109impl Fixture {
110 fn new(name: &str) -> Self {
111 let root = tempfile::TempDir::new().expect("repo tempdir");
112 let home = tempfile::TempDir::new().expect("home tempdir");
113 git_ok(root.path(), &["init", "-q", "-b", "main"]);
114 fs::write(root.path().join("tracked.txt"), b"anchor me\n").expect("write");
115 fs::write(root.path().join("other.txt"), b"v0\n").expect("write");
116 // Keep private workspace state out of the pending-edit capture.
117 fs::write(
118 root.path().join(".atomicignore"),
119 ".atomic\n.git\n.vault\n.atomicignore\nbuild-cache/\n",
120 )
121 .expect("write ignore");
122 git_ok(root.path(), &["add", "tracked.txt", "other.txt"]);
123 git_ok(root.path(), &["commit", "-qm", "C0"]);
124 atomic_ok(root.path(), home.path(), &["init"]);
125 atomic_ok(root.path(), home.path(), &["git", "import", "--no-vault"]);
126 let key = write_key_file(home.path(), &format!("{name}.hex"), 0x71);
127 atomic_ok(
128 root.path(),
129 home.path(),
130 &[
131 "git",
132 "shim",
133 "enable",
134 "--binding-key-file",
135 key.to_str().unwrap(),
136 ],
137 );
138 // C1: a second bound commit that leaves tracked.txt unchanged.
139 fs::write(root.path().join("other.txt"), b"v1\n").expect("write");
140 git_ok(root.path(), &["commit", "-qam", "C1 other file"]);
141 atomic_ok(root.path(), home.path(), &["git", "shim", "reconcile"]);
142 atomic_ok(
143 root.path(),
144 home.path(),
145 &[
146 "git",
147 "shim",
148 "binding",
149 "publish",
150 "--key-file",
151 key.to_str().unwrap(),
152 ],
153 );
154 Self { root, home, key }
155 }
156
157 fn root(&self) -> &Path {
158 self.root.path()

Callers

nothing calls this directly

Calls 6

git_okFunction · 0.70
writeFunction · 0.70
atomic_okFunction · 0.70
write_key_fileFunction · 0.70
pathMethod · 0.45
unwrapMethod · 0.45

Tested by

no test coverage detected