Fix EOF handling in TextFragment#ApplyStrict

io.EOF was not properly accounted for when dealing with patches that are
missing trailing newline characters.
This commit is contained in:
Billy Keyes
2020-01-09 22:05:24 -08:00
parent 02f7ff4f79
commit 7bd4e0bb0e
9 changed files with 70 additions and 23 deletions
@@ -0,0 +1,5 @@
line 1
line 2
line 3
line 4
line 5
@@ -0,0 +1,11 @@
diff --git a/gitdiff/testdata/apply/text_fragment_add_end_noeol.src b/gitdiff/testdata/apply/text_fragment_add_end_noeol.src
--- a/gitdiff/testdata/apply/text_fragment_add_end_noeol.src
+++ b/gitdiff/testdata/apply/text_fragment_add_end_noeol.src
@@ -1,3 +1,5 @@
line 1
line 2
-line 3
\ No newline at end of file
+line 3
+line 4
+line 5
@@ -0,0 +1,3 @@
line 1
line 2
line 3
@@ -0,0 +1 @@
new line a
@@ -0,0 +1,8 @@
diff --git a/gitdiff/testdata/apply/text_fragment_change_single_noeol.src b/gitdiff/testdata/apply/text_fragment_change_single_noeol.src
--- a/gitdiff/testdata/apply/text_fragment_change_single_noeol.src
+++ b/gitdiff/testdata/apply/text_fragment_change_single_noeol.src
@@ -1 +1 @@
-line 1
\ No newline at end of file
+new line a
\ No newline at end of file
@@ -0,0 +1 @@
line 1