Skip to content

Commit 8aad7f3

Browse files
committed
Add ignored test for resolved merge conflict
1 parent 33cd07e commit 8aad7f3

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed

gix-blame/tests/blame.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,37 @@ mktest!(added_line_before_changed_line, "added-line-before-changed-line", 3);
235235
mktest!(same_line_changed_twice, "same-line-changed-twice", 2);
236236
mktest!(coalesce_adjacent_hunks, "coalesce-adjacent-hunks", 1);
237237

238+
#[test]
239+
#[ignore = "TODO: as of October 2024, passing blames to more than one parent is not fully implemented yet"]
240+
fn merge_commits() {
241+
for case in ["resolved-conflict"] {
242+
let Fixture {
243+
worktree_path,
244+
odb,
245+
mut resource_cache,
246+
suspect,
247+
commits,
248+
} = Fixture::new().unwrap();
249+
250+
let lines_blamed = blame_file(
251+
&odb,
252+
commits,
253+
&mut resource_cache,
254+
suspect,
255+
worktree_path,
256+
format!("{case}.txt").as_str().into(),
257+
)
258+
.unwrap();
259+
260+
assert_ne!(lines_blamed.len(), 0);
261+
262+
let git_dir = fixture_path().join(".git");
263+
let baseline = Baseline::collect(git_dir.join(format!("{case}.baseline"))).unwrap();
264+
265+
assert_eq!(lines_blamed, baseline, "{case}");
266+
}
267+
}
268+
238269
#[test]
239270
#[ignore = "TBD: figure out what the problem is"]
240271
// As of 2024-09-24, these tests are expected to fail.

gix-blame/tests/fixtures/make_blame_repo.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,32 @@ cp empty-lines-histogram.txt empty-lines-myers.txt
128128
git add empty-lines-histogram.txt empty-lines-myers.txt
129129
git commit -q -m c5.4
130130

131+
# The commit history created by the commits above this line is linear, it only
132+
# contains commits that have exactly one parent.
133+
# Below this line, there’s also commits that have more than one parent.
134+
135+
echo -e "line 1 original\nline 2\n line 3" > resolved-conflict.txt
136+
git add resolved-conflict.txt
137+
git commit -q -m c6
138+
139+
echo -e "line 1 changed\nline 2\n line 3" > resolved-conflict.txt
140+
git add resolved-conflict.txt
141+
git commit -q -m c7
142+
143+
git checkout -b different-branch-to-create-a-conflict
144+
git reset --hard HEAD~1
145+
146+
echo -e "line 1 changed in a different way\nline 2\n line 3" > resolved-conflict.txt
147+
git add resolved-conflict.txt
148+
git commit -q -m c8
149+
150+
git checkout main
151+
git merge different-branch-to-create-a-conflict || true
152+
153+
echo -e "line 1 conflict resolved\nline 2\n line 3" > resolved-conflict.txt
154+
git add resolved-conflict.txt
155+
git commit -q -m c9
156+
131157
git blame --porcelain simple.txt > .git/simple.baseline
132158
git blame --porcelain multiline-hunks.txt > .git/multiline-hunks.baseline
133159
git blame --porcelain deleted-lines.txt > .git/deleted-lines.baseline
@@ -141,6 +167,8 @@ git blame --porcelain added-line-before-changed-line.txt > .git/added-line-befor
141167
git blame --porcelain same-line-changed-twice.txt > .git/same-line-changed-twice.baseline
142168
git blame --porcelain coalesce-adjacent-hunks.txt > .git/coalesce-adjacent-hunks.baseline
143169

170+
git blame --porcelain resolved-conflict.txt > .git/resolved-conflict.baseline
171+
144172
git blame --porcelain empty-lines-histogram.txt > .git/empty-lines-histogram.baseline
145173

146174
git config --local diff.algorithm myers

0 commit comments

Comments
 (0)