我正在使用标志 ( )repo.status().items()
在预提交挂钩中运行,我得到的结果如下所示:-a
git commit -a -m "Test"
[('config/git_hooks/pre-commit', 256), ('bin/run_flake8', 256)]
如果我git status
在同一个过程中运行,我会得到:
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
换句话说,pygit2 将这些文件报告为未暂存,而 git 将它们报告为已暂存。
我不清楚这是 libgit2 还是 pygit2 的问题。我试过挖掘源代码,但它非常复杂。为什么会出现差异?