libgit2 / pygit2

Python bindings for libgit2
https://www.pygit2.org/
Other
1.58k stars 382 forks source link

Apply Function on Repository Fails on blank lines #1107

Open fizzerle opened 2 years ago

fizzerle commented 2 years ago

The apply Function of the Repository Class fails if a diff contains a blank line with the Error = "Error: _pygit2.GitError: hunk at line ... did not apply"

To make it more clear. The hunk

   -    this is a
   -    test
   -
repo.apply(diff,pygit2.GIT_APPLY_LOCATION_INDEX)

has a blank last line that is removed. This hunk fails when applied.