pygit2 appears to return the wrong flags for repo.status()

155 views Asked by At

I'm running repo.status().items() in a pre-commit hook using the -a flag (git commit -a -m "Test"), and I get a result that looks like this:

[('config/git_hooks/pre-commit', 256), ('bin/run_flake8', 256)]

If I run git status in that same process, I get:

On branch ops_1331_fix
Your branch is ahead of 'origin/ops_1331_fix' by 2 commits.
  (use "git push" to publish your local commits)
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   bin/run_flake8
    modified:   config/git_hooks/pre-commit

In other words, pygit2 is reporting those files as not being staged, and git is reporting them as being staged.

It's not clear to me whether this is an issue with libgit2 or pygit2. I've tried digging through the source code, but it's pretty convoluted. Why the discrepancy?

0

There are 0 answers