libgit2 / libgit2/pygit2

flaky repo.reset() behavior

Open
#1,059 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 issue is about repo.reset() not seeming to work reliably 100% of the time.

I have some CI tests that modify a file in a non-bare repo, commit the change to a branch, and then call repo.reset() with GIT_RESET_HARD to restore to a different commit. After calling reset, to confirm that the reset was successful, the test creates a new Repository object and checks the repository's status using repo.status(). Occasionally (but very rarely), the status check comes back showing the original file still as WT_MODIFIED. A subsequent call to repo.diff() confirms the difference in the file. Is there something pygit2 is or isn't doing that could cause reset() to behave flakily like this? Or is libgit2 the more likely culprit?

This is using pygit2 1.2.0. I can try upgrading, but is there a reason to think this would be fixed in a newer version (e.g. a known issue that was fixed)? I haven't found anything like this in pygit2 or libgit2's issue tracker or release notes.

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 by reproducing the reported CI sequence with pygit2 1.2.0: modify and commit a file in a non-bare repository, call repo.reset() with GIT_RESET_HARD, then create a new Repository and compare repo.status() with repo.diff(). Done means identifying whether the intermittent WT_MODIFIED result comes from pygit2 or libgit2 and documenting the cause or a confirmed fix path.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, python
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.