Skip to content

Commit

Permalink
Add test for same line changed twice
Browse files Browse the repository at this point in the history
  • Loading branch information
cruessler committed Sep 10, 2024
1 parent 01f747f commit d64fb23
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gix-blame/tests/blame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ mktest!(
mktest!(added_lines, "added-lines", 2);
mktest!(added_lines_around, "added-lines-around", 3);
mktest!(switched_lines, "switched-lines", 4);
mktest!(name_not_yet_known, "added-line-before-changed-line", 3);
mktest!(added_line_before_changed_line, "added-line-before-changed-line", 3);
mktest!(same_line_changed_twice, "same-line-changed-twice", 2);

#[test]
fn process_changes_works() {
Expand Down
13 changes: 13 additions & 0 deletions gix-blame/tests/fixtures/make_blame_repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ echo -e "line 1\nline 2\nline 3" > added-line-before-changed-line.txt
git add added-line-before-changed-line.txt
git commit -q -m c2.3

echo -e "line 1\nline 2" > same-line-changed-twice.txt
git add same-line-changed-twice.txt
git commit -q -m c2.4

echo "line 3" >> simple.txt
git add simple.txt
git commit -q -m c3
Expand All @@ -64,6 +68,10 @@ echo -e "line 2\nline 3" > added-line-before-changed-line.txt
git add added-line-before-changed-line.txt
git commit -q -m c3.3

echo -e "line 1\nline 2 changed" > same-line-changed-twice.txt
git add same-line-changed-twice.txt
git commit -q -m c3.4

echo "line 4" >> simple.txt
git add simple.txt
git commit -q -m c4
Expand All @@ -80,6 +88,10 @@ echo -e "line 2 changed\nline 3" > added-line-before-changed-line.txt
git add added-line-before-changed-line.txt
git commit -q -m c4.3

echo -e "line 1\nline 2 changed a second time" > same-line-changed-twice.txt
git add same-line-changed-twice.txt
git commit -q -m c4.4

echo -e "line 0\nline 1\nline 2" > added-lines.txt
echo -e "line 0\nline 1\nline 2\nline 3" > added-lines-around.txt
git add added-lines.txt
Expand Down Expand Up @@ -108,3 +120,4 @@ git blame --porcelain added-lines.txt > .git/added-lines.baseline
git blame --porcelain added-lines-around.txt > .git/added-lines-around.baseline
git blame --porcelain switched-lines.txt > .git/switched-lines.baseline
git blame --porcelain added-line-before-changed-line.txt > .git/added-line-before-changed-line.baseline
git blame --porcelain same-line-changed-twice.txt > .git/same-line-changed-twice.baseline

0 comments on commit d64fb23

Please sign in to comment.