mirror of
https://github.com/bluekeyes/go-gitdiff
synced 2026-06-08 13:18:30 +00:00
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:
@@ -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
|
||||
Reference in New Issue
Block a user