-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix edge case when diff changes were exactly "++ " or "-- "
In those cases, sometimes, that was leading to the lines to be recognised as a new file incorrectly, causing various troubles later in the process. Now we look for the two lines in a row, and only when they have something looking like a path: - /dev/null - /path/to/something Covered with test containing the edge cases.
- Loading branch information
Showing
8 changed files
with
81 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/fixtures/diff_extract_changes/diff_extract_changes-edge-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
another_binary.png: | ||
diff_extract_changes_edge_cases.txt:10-10;13-13; |
9 changes: 9 additions & 0 deletions
9
tests/fixtures/diff_extract_changes/diff_extract_changes-edge-expected.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<diffchanges version="20240323"> | ||
<file name="another_binary.png"> | ||
</file> | ||
<file name="diff_extract_changes_edge_cases.txt"> | ||
<lines from="10" to="10"/> | ||
<lines from="13" to="13"/> | ||
</file> | ||
</diffchanges> |
25 changes: 25 additions & 0 deletions
25
tests/fixtures/diff_extract_changes/diff_extract_changes-edge-input.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/another_binary.png b/another_binary.png | ||
new file mode 100644 | ||
index 00000000000..3cb4b3d9aaf | ||
Binary files /dev/null and b/another_binary.png differ | ||
diff --git a/diff_extract_changes_edge_cases.txt b/diff_extract_changes_edge_cases.txt | ||
index 4e020b9abcd..21a2225922f 100644 | ||
--- a/diff_extract_changes_edge_cases.txt | ||
+++ b/diff_extract_changes_edge_cases.txt | ||
@@ -5,10 +5,9 @@ Let's see how out diff extractor behaves with some edge cases. | ||
+ | ||
- | ||
++ | ||
--- | ||
+++ | ||
---- | ||
++ | ||
--- | ||
+++ | ||
+ | ||
- | ||
+-- | ||
diff --git a/some_binary1.png b/some_binary1.png | ||
deleted file mode 100644 | ||
index f6277460437..00000000000 | ||
Binary files a/some_binary1.png and /dev/null differ |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.