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

Method new

atomic-cli/tests/it/git_anchor_cb7a_test.rs:105–120  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

103
104impl Colocated {
105 fn new(name: &str) -> Self {
106 let root = tempfile::TempDir::new().expect("repo tempdir");
107 let home = tempfile::TempDir::new().expect("home tempdir");
108 git_ok(root.path(), &["init", "-q", "-b", "main"]);
109 fs::write(root.path().join("tracked.txt"), b"anchor me\n").expect("write file");
110 fs::create_dir(root.path().join("nested")).expect("nested dir");
111 fs::write(root.path().join("nested/inner.txt"), b"inner\n").expect("write file");
112 git_ok(root.path(), &["add", "tracked.txt", "nested/inner.txt"]);
113 git_ok(root.path(), &["commit", "-qm", "anchor base"]);
114 atomic_ok(root.path(), home.path(), &["init"]);
115 atomic_ok(root.path(), home.path(), &["git", "import", "--no-vault"]);
116 // The Anchor key must live outside the worktree: any untracked file
117 // breaks complete manifest equivalence by design (RFC §12.5).
118 let key = write_key_file(home.path(), &format!("{name}.hex"), 0x71);
119 Self { root, home, key }
120 }
121
122 fn key(&self) -> &Path {
123 &self.key

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected