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 seen with v0.7.1 #89

Open
marxin opened this issue Jan 28, 2022 · 5 comments
Open

unidiff.errors.UnidiffParseError seen with v0.7.1 #89

marxin opened this issue Jan 28, 2022 · 5 comments

Comments

@marxin
Copy link
Contributor

marxin commented Jan 28, 2022

I see the following regression starting with fd58ddc:

/tmp/venv/bin/python -c 'import unidiff; unidiff.PatchSet.from_filename("test.patch.txt")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/marxin/Programming/python-unidiff/unidiff/patch.py", line 591, in from_filename
    instance = cls(f)
  File "/home/marxin/Programming/python-unidiff/unidiff/patch.py", line 454, in __init__
    self._parse(data, encoding=encoding, metadata_only=metadata_only)
  File "/home/marxin/Programming/python-unidiff/unidiff/patch.py", line 506, in _parse
    raise UnidiffParseError('Unexpected new file found: %s' % line)
unidiff.errors.UnidiffParseError: Unexpected new file found: new file mode 100644

test.patch.txt

@yan12125
Copy link

Looks like the regular expression to parse git diff header does not consider quotes

https://github.com/matiasb/python-unidiff/blob/v0.7.1/unidiff/constants.py#L40

@marxin
Copy link
Contributor Author

marxin commented Jan 28, 2022

@Felixoid

@matiasb
Copy link
Owner

matiasb commented Jan 28, 2022

Right, none of the regexes is considering the quotes (not a new issue, but with the changes parsing the git diff header the given diff breaks). #90 will fix the parsing so this works, but quotes support will need to be worked out later.

@yan12125
Copy link

Thanks, version 0.7.2 works great!

@marxin
Copy link
Contributor Author

marxin commented Jan 28, 2022

Thanks, I can confirm it works for me now.

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

3 participants