| 106 | |
| 107 | impl Colocated { |
| 108 | fn new(name: &str) -> Self { |
| 109 | let root = tempfile::TempDir::new().expect("repo tempdir"); |
| 110 | let home = tempfile::TempDir::new().expect("home tempdir"); |
| 111 | let git = |args: &[&str]| { |
| 112 | Command::new("git") |
| 113 | .args(args) |
| 114 | .current_dir(root.path()) |
| 115 | .env("GIT_AUTHOR_NAME", "CB-8A Tests") |
| 116 | .env("GIT_AUTHOR_EMAIL", "cb8a@example.com") |
| 117 | .env("GIT_COMMITTER_NAME", "CB-8A Tests") |
| 118 | .env("GIT_COMMITTER_EMAIL", "cb8a@example.com") |
| 119 | .output() |
| 120 | .expect("run git") |
| 121 | }; |
| 122 | assert!(git(&["init", "-q", "-b", "main"]).status.success()); |
| 123 | fs::write(root.path().join("tracked.txt"), b"anchor me\n").expect("write file"); |
| 124 | fs::create_dir(root.path().join("nested")).expect("nested dir"); |
| 125 | fs::write(root.path().join("nested/inner.txt"), b"inner\n").expect("write file"); |
| 126 | assert!(git(&["add", "tracked.txt", "nested/inner.txt"]) |
| 127 | .status |
| 128 | .success()); |
| 129 | assert!(git(&["commit", "-qm", "anchor base"]).status.success()); |
| 130 | atomic_ok(root.path(), home.path(), &["init", "--no-vault"]); |
| 131 | // The `.atomicignore` removal-lease failure on view switches is a |
| 132 | // known pre-existing CB-5C-era issue (tracked in the CB-8A report as |
| 133 | // out of scope); this fixture removes the seeded file so the |
| 134 | // projection and HEAD-policy behavior under test stays reachable. |
| 135 | fs::remove_file(root.path().join(".atomicignore")).expect("remove atomicignore"); |
| 136 | atomic_ok(root.path(), home.path(), &["git", "import", "--no-vault"]); |
| 137 | let _ = name; |
| 138 | Self { root, home } |
| 139 | } |
| 140 | |
| 141 | fn root(&self) -> &Path { |
| 142 | self.root.path() |