()
| 224 | } |
| 225 | |
| 226 | fn merge_fixture() -> MergeFixture { |
| 227 | let root = tempfile::tempdir().unwrap().keep(); |
| 228 | let home = tempfile::tempdir().unwrap().keep(); |
| 229 | git(&root, &["init", "-q", "-b", "main"]); |
| 230 | fs::write(root.join("a.txt"), b"line1\nline9\n").unwrap(); |
| 231 | git(&root, &["add", "."]); |
| 232 | git(&root, &["commit", "-q", "-m", "base"]); |
| 233 | let base = git(&root, &["rev-parse", "HEAD"]); |
| 234 | |
| 235 | git(&root, &["checkout", "-q", "-b", "side-a"]); |
| 236 | fs::write(root.join("a.txt"), b"line1\nside-a\nline9\n"); |
| 237 | git_commit(&root, "side a"); |
| 238 | let side_a = git(&root, &["rev-parse", "HEAD"]); |
| 239 | |
| 240 | git(&root, &["checkout", "-q", "main"]); |
| 241 | git(&root, &["checkout", "-q", "-b", "side-b"]); |
| 242 | fs::write(root.join("a.txt"), b"line1\nside-b\nline9\n"); |
| 243 | git_commit(&root, "side b"); |
| 244 | let side_b = git(&root, &["rev-parse", "HEAD"]); |
| 245 | |
| 246 | git(&root, &["checkout", "-q", "side-a"]); |
| 247 | let merge_out = Command::new("git") |
| 248 | .args(["merge", "--no-ff", "side-b", "-m", "merge side work"]) |
| 249 | .current_dir(&root) |
| 250 | .env("GIT_AUTHOR_NAME", "CB-9B Tests") |
| 251 | .env("GIT_AUTHOR_EMAIL", "cb9b@example.com") |
| 252 | .env("GIT_COMMITTER_NAME", "CB-9B Tests") |
| 253 | .env("GIT_COMMITTER_EMAIL", "cb9b@example.com") |
| 254 | .output() |
| 255 | .expect("git merge"); |
| 256 | assert!( |
| 257 | !merge_out.status.success(), |
| 258 | "the fixture merge must conflict; the test resolves it explicitly" |
| 259 | ); |
| 260 | fs::write(root.join("a.txt"), b"line1\nresolved\nline9\n"); |
| 261 | git_commit(&root, "merge side work"); |
| 262 | let merge = git(&root, &["rev-parse", "HEAD"]); |
| 263 | git(&root, &["checkout", "-q", "main"]); |
| 264 | git(&root, &["merge", "-q", "--ff-only", "side-a"]); |
| 265 | |
| 266 | MergeFixture { |
| 267 | root, |
| 268 | home, |
| 269 | base, |
| 270 | side_a, |
| 271 | side_b, |
| 272 | merge, |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | /// A merge imports every parent closure and resolves from the union state |
| 277 | /// with a verified frontier covering both parents. |
no test coverage detected