libgit2 / libgit2/pygit2

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

Open
#1,260 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.7k
Forks
408
Avg merge
2d 57m
Merged PRs (30d)
7

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pygit2.Diff.parse_diff() and reproduce the failure using the attached full_pr.diff.txt, focusing on line 3734 and the filename containing spaces. Done means the supplied diff parses successfully without requiring the filename to be renamed or quoted.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.