Skip to content

Commit 0f7ef0d

Browse files
committed
Add failing test for diffs containing empty lines
1 parent 01722e9 commit 0f7ef0d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

gix-blame/tests/blame.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,12 @@ mktest!(added_line_before_changed_line, "added-line-before-changed-line", 3);
140140
mktest!(same_line_changed_twice, "same-line-changed-twice", 2);
141141
mktest!(coalesce_adjacent_hunks, "coalesce-adjacent-hunks", 1);
142142

143+
// As of 2024-09-24, these tests are expected to fail.
144+
//
145+
// Context: https://github.com/Byron/gitoxide/pull/1453#issuecomment-2371013904
146+
mktest!(empty_lines_histogram, "empty-lines-histogram", 5);
147+
mktest!(empty_lines_myers, "empty-lines-myers", 5);
148+
143149
#[test]
144150
fn process_change_works() {
145151
let mut lines_blamed = Vec::new();

gix-blame/tests/fixtures/make_blame_repo.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4+
git config --local diff.algorithm histogram
5+
46
git init -q
57
git config merge.ff false
68

@@ -98,6 +100,11 @@ echo -e "line 1\nline 2 changed a second time" > same-line-changed-twice.txt
98100
git add same-line-changed-twice.txt
99101
git commit -q -m c4.4
100102

103+
echo -e " line 1\n\n line 2\n\n line 3" > empty-lines-histogram.txt
104+
cp empty-lines-histogram.txt empty-lines-myers.txt
105+
git add empty-lines-histogram.txt empty-lines-myers.txt
106+
git commit -q -m c4.5
107+
101108
echo -e "line 0\nline 1\nline 2" > added-lines.txt
102109
echo -e "line 0\nline 1\nline 2\nline 3" > added-lines-around.txt
103110
git add added-lines.txt
@@ -116,6 +123,11 @@ echo -e "line 1\nline 2 changed\nline 3" > added-line-before-changed-line.txt
116123
git add added-line-before-changed-line.txt
117124
git commit -q -m c5.3
118125

126+
echo -e " line 1\n\n line in between\n\n line 2\n\n line in between\n\n line 3" > empty-lines-histogram.txt
127+
cp empty-lines-histogram.txt empty-lines-myers.txt
128+
git add empty-lines-histogram.txt empty-lines-myers.txt
129+
git commit -q -m c5.4
130+
119131
git blame --porcelain simple.txt > .git/simple.baseline
120132
git blame --porcelain multiline-hunks.txt > .git/multiline-hunks.baseline
121133
git blame --porcelain deleted-lines.txt > .git/deleted-lines.baseline
@@ -128,3 +140,9 @@ git blame --porcelain switched-lines.txt > .git/switched-lines.baseline
128140
git blame --porcelain added-line-before-changed-line.txt > .git/added-line-before-changed-line.baseline
129141
git blame --porcelain same-line-changed-twice.txt > .git/same-line-changed-twice.baseline
130142
git blame --porcelain coalesce-adjacent-hunks.txt > .git/coalesce-adjacent-hunks.baseline
143+
144+
git blame --porcelain empty-lines-histogram.txt > .git/empty-lines-histogram.baseline
145+
146+
git config --local diff.algorithm myers
147+
148+
git blame --porcelain empty-lines-myers.txt > .git/empty-lines-myers.baseline

0 commit comments

Comments
 (0)