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

unidiff.errors.UnidiffParseError: Unexpected hunk found: @@ -2,6 +2,6 @@ #115

Open
bernd-wechner opened this issue Dec 4, 2023 · 2 comments

Comments

@bernd-wechner
Copy link

I am writing diff files using Python's difflib.unified_diff();

One such file commences with:

--- 
+++ 
@@ -2,6 +2,6 @@

if I try to read it then unidiff fails with:

unidiff.errors.UnidiffParseError: Unexpected hunk found: @@ -2,6 +2,6 @@

I am left suspecting, when comparing it with the README samples that the missing filename is bothering it. If so, it shouldn't really given that difflib.unified_diff() produces output that lacks it.

@bernd-wechner
Copy link
Author

bernd-wechner commented Dec 4, 2023

Manually adding a filename as in:

--- test1
+++ test2
@@ -2,6 +2,6 @@

sees it loaded fine. Looks like I'll have to ask difflib to write those filenames out. All good I guess, though I can't help but feel as they are optional in difflib, they should rightly be optional in unidiff too. But that of course is a matter of opinion.

@nsbradford
Copy link

+1 i also have this issue

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