Consider a patch with multiple diffs. When the last diff has newline character delta, and also there is a text delta on the last line, it fails to parse. If this diff was not the last in the patch file, then it succeeds parsing.
Consider the following diff below which is last in the patch file.
diff --git a/file.ext b/file.ext
index aec721ec82..a3db8308b6 100644
--- a/file.h
+++ b/file.h
@@ -3,5 +3,6 @@
context
-#endif
\ No newline at end of file
+#endif
This gets an error:
thread 'main' panicked at /home/aj/git/patch-rs/src/parser.rs:84:5:
bug: failed to parse entire input. Remaining: '+#endif
'
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I tried manually removing just the last 1 lines of the diff (+#endif), and it succeeds parsing.