Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse patch that ends with newline character change and delta on the last line #23

Open
aurabindo opened this issue Feb 27, 2024 · 1 comment

Comments

@aurabindo
Copy link

aurabindo commented Feb 27, 2024

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.

@aurabindo aurabindo changed the title Cannot parse patch that ends with newline indicator and delta on the last line Cannot parse patch that ends with newline character change and delta on the last line Feb 27, 2024
@nichmor
Copy link

nichmor commented Jun 17, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants