libgit2 / libgit2/pygit2

Apply Function on Repository Fails on blank lines

Open
#1,107 0 comments 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

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.

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 at the Repository.apply entry point and reproduce the shown diff containing a blank final line with repo.apply(diff, pygit2.GIT_APPLY_LOCATION_INDEX). Done means this hunk applies successfully without the reported _pygit2.GitError.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.