A linked worktree sharing this fixture's common .atomic (the linked-worktree equivalence corpus: the reactive pass runs in the linked tree through the SAME canonical store).
(&self, _name: &str)
| 276 | /// linked-worktree equivalence corpus: the reactive pass runs in the |
| 277 | /// linked tree through the SAME canonical store). |
| 278 | fn linked_worktree(&self, _name: &str) -> Self { |
| 279 | let linked_root = TempDir::new().expect("linked tempdir"); |
| 280 | let output = Command::new("git") |
| 281 | .arg("-C") |
| 282 | .arg(self.root()) |
| 283 | .args([ |
| 284 | "worktree", |
| 285 | "add", |
| 286 | "-q", |
| 287 | "--detach", |
| 288 | linked_root.path().to_str().expect("utf8"), |
| 289 | ]) |
| 290 | .env("GIT_CONFIG_NOSYSTEM", "1") |
| 291 | .env("GIT_CONFIG_GLOBAL", "/dev/null") |
| 292 | .env("GIT_AUTHOR_DATE", "@1726732800 +0000") |
| 293 | .env("GIT_COMMITTER_DATE", "@1726732800 +0000") |
| 294 | .output() |
| 295 | .expect("run git worktree add"); |
| 296 | assert!( |
| 297 | output.status.success(), |
| 298 | "git worktree add failed:\n{}", |
| 299 | String::from_utf8_lossy(&output.stderr) |
| 300 | ); |
| 301 | // The linked worktree uses the SANDBOX-STYLE pointer: its local |
| 302 | // .atomic carries only the repository pointer (the canonical graph |
| 303 | // lives in the primary's .atomic). A read command registers the |
| 304 | // linked working-copy identity (the cb7a linked-worktree contract). |
| 305 | fs::create_dir_all(linked_root.path().join(".atomic")).expect("worktree dot dir"); |
| 306 | let pointer = format!("{}/.atomic", self.root().display()); |
| 307 | fs::write(linked_root.path().join(".atomic/repository"), pointer) |
| 308 | .expect("repository pointer"); |
| 309 | atomic_ok(linked_root.path(), self.home(), &["view", "list"]); |
| 310 | // The cb7a linked-worktree adoption: a detached checkout of the |
| 311 | // bound commit in the linked tree adopts into its OWN ephemeral |
| 312 | // view (`git/<short-oid>`) with its own checkpoint — via the |
| 313 | // status boundary (§7.5, §12.1). |
| 314 | atomic_ok(linked_root.path(), self.home(), &["status", "--short"]); |
| 315 | let home = TempDir::new().expect("linked home"); |
| 316 | Self { |
| 317 | root: linked_root, |
| 318 | home, |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | fn watch_once(&self) -> Output { |
| 323 | atomic( |