libgit2 / libgit2/libgit2sharp

Repository.Reset doesn't checkout files having only a single line's line ending changed

Open
#1,327 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

If the line ending of only one line somewhere in the middle of a file, the file is not detected as Dirty by the reset method and the change is not reverted after calling it.

On the other hand Repository.RetrieveStatus correctly returns the file as modified

I'm attaching a test repo which shows the issue with version v0.22 from NuGet (Note that I had to change the zip file's extension to txt because otherwise GitHub rejected it for some reason...).

test-repo.zip.txt

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 the attached test repository and the Repository.Reset and Repository.RetrieveStatus entry points. Compare how each handles a file with one changed line ending; done means Reset detects the file as Dirty and reverts that change, with a regression test covering the case.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
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.