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

Function ordered_merge_fixture

atomic-cli/tests/it/git_import_cb9b_test.rs:1115–1158  ·  view source on GitHub ↗
(a_date: &str, b_date: &str)

Source from the content-addressed store, hash-verified

1113}
1114
1115fn ordered_merge_fixture(a_date: &str, b_date: &str) -> OrderedMergeFixture {
1116 let root = tempfile::tempdir().unwrap().keep();
1117 let home = tempfile::tempdir().unwrap().keep();
1118 git(&root, &["init", "-q", "-b", "main"]);
1119 fs::write(root.join("a.txt"), b"line1\nline9\n").unwrap();
1120 git_commit(&root, "base");
1121
1122 git(&root, &["checkout", "-q", "-b", "side-a"]);
1123 fs::write(root.join("a.txt"), b"line1\nside-a\nline9\n");
1124 let side_a = git_commit_at(&root, a_date, "side a");
1125
1126 git(&root, &["checkout", "-q", "main"]);
1127 git(&root, &["checkout", "-q", "-b", "side-b"]);
1128 fs::write(root.join("a.txt"), b"line1\nside-b\nline9\n");
1129 let side_b = git_commit_at(&root, b_date, "side b");
1130
1131 git(&root, &["checkout", "-q", "side-a"]);
1132 let merge_out = Command::new("git")
1133 .args(["merge", "--no-ff", "side-b", "-m", "merge side work"])
1134 .current_dir(&root)
1135 .env("GIT_AUTHOR_NAME", "CB-9B Tests")
1136 .env("GIT_AUTHOR_EMAIL", "cb9b@example.com")
1137 .env("GIT_COMMITTER_NAME", "CB-9B Tests")
1138 .env("GIT_COMMITTER_EMAIL", "cb9b@example.com")
1139 .output()
1140 .expect("git merge");
1141 assert!(
1142 !merge_out.status.success(),
1143 "the fixture merge must conflict; the test resolves it explicitly"
1144 );
1145 fs::write(root.join("a.txt"), b"line1\nresolved\nline9\n");
1146 git_commit(&root, "merge side work");
1147 let merge = git(&root, &["rev-parse", "HEAD"]);
1148 git(&root, &["checkout", "-q", "main"]);
1149 git(&root, &["merge", "-q", "--ff-only", "side-a"]);
1150
1151 OrderedMergeFixture {
1152 root,
1153 home,
1154 side_a,
1155 side_b,
1156 merge,
1157 }
1158}
1159
1160fn assert_no_sibling_dependency(
1161 repo: &atomic_repository::Repository,

Calls 6

git_commit_atFunction · 0.85
gitFunction · 0.70
writeFunction · 0.70
git_commitFunction · 0.70
unwrapMethod · 0.45
outputMethod · 0.45

Tested by

no test coverage detected