| 650 | } |
| 651 | |
| 652 | fn commit_on(git: &GitRepository, message: &str, parents: &[git2::Oid]) -> git2::Oid { |
| 653 | let tree_id = if parents.is_empty() { |
| 654 | let builder = git.treebuilder(None).unwrap(); |
| 655 | builder.write().unwrap() |
| 656 | } else { |
| 657 | git.find_commit(parents[0]).unwrap().tree_id() |
| 658 | }; |
| 659 | let tree = git.find_tree(tree_id).unwrap(); |
| 660 | let signature = Signature::now("CB-10A Tests", "cb10a@example.com").unwrap(); |
| 661 | let parents: Vec<git2::Commit> = parents |
| 662 | .iter() |
| 663 | .map(|oid| git.find_commit(*oid).unwrap()) |
| 664 | .collect(); |
| 665 | let parents: Vec<&git2::Commit> = parents.iter().collect(); |
| 666 | // No ref update: the probe builds arbitrary shapes. |
| 667 | git.commit(None, &signature, &signature, message, &tree, &parents) |
| 668 | .unwrap() |
| 669 | } |
| 670 | |
| 671 | /// CB-10A review R2: the four-commit A→B probe. With observed = B |
| 672 | /// (A ← B) and tip = M (a merge of B and C, where C descends from A), |