pygit2 icon indicating copy to clipboard operation
pygit2 copied to clipboard

GitError raised on parsing a diff that has a filename with spaces

Open 2bndy5 opened this issue 2 years ago • 1 comments

This was raised originally at cpp-linter/cpp-linter-action#178 in which a large diff was parsed by pygit2.Diff.parse_diff() (on ubuntu-latset CI github runner).

The error says:

pygit2.GitError: trailing data at line 3734

Here's the full diff: full_pr.diff.txt which was generated by github with the URL https://github.com/edunad/rawrbox/pull/108.diff

Line 3734 is

rename from render/content/fonts/SIL Open Font License.txt

I was able to reproduce this error locally on Windows. Is this expected behavior?

If I remove the spaces from the file name or put the entire path in quotes, then the diff is parsed without problem.

2bndy5 avatar Dec 23 '23 02:12 2bndy5

I tried to parse the diff in the rust binding git2-rs and got the same error, so I think this a problem with libgit2 C library itself.

This seems similar to libgit2/libgit2#5029 except the space is in a renamed filename.

2bndy5 avatar Dec 23 '23 04:12 2bndy5