Skip to content

Hunk diff line expected #120

@martinclauss

Description

@martinclauss

Hey :)

First of all thanks for creating this nice library ;)

When I parse this diff: https://github.com/vim/vim/commit/c101abff4c6756db4f5e740fde289decb9452efa.diff

I get

File "/home/user/venvs/ml/lib64/python3.12/site-packages/unidiff/patch.py", line 462, in __init__
    self._parse(data, encoding=encoding, metadata_only=metadata_only)
  File "/home/user/venvs/ml/lib64/python3.12/site-packages/unidiff/patch.py", line 552, in _parse
    current_file._parse_hunk(line, diff, encoding, metadata_only)
  File "/home/user/venvs/ml/lib64/python3.12/site-packages/unidiff/patch.py", line 318, in _parse_hunk
    raise UnidiffParseError(
unidiff.errors.UnidiffParseError: Hunk diff line expected: oodeuR

Those bytes are indeed a bit wierd if looked at as UTF-8

│00000500│ 73 70 6c 69 74 20 30 0a ┊ 2b 20 20 73 69 6c 21 20 │split 0_┊+  sil! │
│00000510│ 6e 6f 72 6d 20 52 0d 1b ┊ 64 6f 6f 1b 62 64 65 75 │norm R_•┊doo•bdeu│
│00000520│ 17 18 52 0d 1b 64 6f 6f ┊ 1b 62 64 65 75 17 18 52 │••R_•doo┊•bdeu••R│
│00000530│ 0d 1b 64 6f 6f 1b 62 64 ┊ 65 75 0a 2b 0a 2b 20 20 │_•doo•bd┊eu_+_+  │

Is there any way to fix this?

Thanks a lot!

Kind regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions