Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1d6d7c6

Browse filesBrowse files
committed
Correct mistaken use of InsertDelta instead of DeleteDelta
Bad copy&paste caused use of InsertDelta instead of DeleteDelta when applying fix for issue dnaumenko#20. Also improved test to cover empty-context patches that delete lines to cover this case.
1 parent 614e861 commit 1d6d7c6
Copy full SHA for 1d6d7c6

File tree

3 files changed

+4
-1
lines changed
Filter options

3 files changed

+4
-1
lines changed

‎src/main/java/difflib/DiffUtils.java

Copy file name to clipboardExpand all lines: src/main/java/difflib/DiffUtils.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public static void processRawChunk(List<String[]> rawChunk, Patch patch, int old
214214
old_ln, oldChunkLines), new Chunk<String>(new_ln - 1,
215215
newChunkLines)));
216216
} else if (newChunkLines.isEmpty()) {
217-
patch.addDelta(new InsertDelta<String>(new Chunk<String>(
217+
patch.addDelta(new DeleteDelta<String>(new Chunk<String>(
218218
old_ln - 1, oldChunkLines), new Chunk<String>(new_ln,
219219
newChunkLines)));
220220
} else {

‎src/test/resources/mocks/uc_insert_patch.txt

Copy file name to clipboardExpand all lines: src/test/resources/mocks/uc_insert_patch.txt
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
+++ uc_insert_revised.txt 2011-06-14 16:20:37.654820000 +0300
33
@@ -2,0 +3 @@
44
+not
5+
@@ -5 +5,0 @@
6+
-file

‎src/test/resources/mocks/uc_original.txt

Copy file name to clipboardExpand all lines: src/test/resources/mocks/uc_original.txt
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ This
22
is
33
a
44
test
5+
file

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.