libgit2 / libgit2/pygit2

`Repository.diff(cached=True)` does not list diffs for indexed files

Open
#712 1 comment 2 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 is with pygit2 version 0.24.0.

$ git init
Initialized empty Git repository in /tmp/minimal/.git/
$ touch foo
$ git add foo
$ git commit -am "First commit"
[master (root-commit) 3551222] First commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
$ echo "foobar" >> foo                                                                                                                                                                                                                                                                                 
$ git add foo
$ git diff --cached
diff --git a/foo b/foo
index e69de29..323fae0 100644
--- a/foo
+++ b/foo
@@ -0,0 +1 @@
+foobar
$ python
>>> import pygit2
>>> repo = pygit2.Repository('.')
>>> list(repo.diff(cached=True))
[]

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 documented pygit2.Repository('.') and Repository.diff(cached=True) example, comparing its result with git diff --cached. Trace the cached diff entry point and related tests in pygit2, then verify that indexed-file changes are returned and match the command-line diff.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.