【发布时间】:2013-04-17 09:44:52
【问题描述】:
我正在使用 pygit2 开发一个非裸存储库
index = repo.index
index.read()
# write in test/test.txt
index.add('test/test.txt')
treeid = index.write_tree()
repo.create_commit(
'HEAD',
author, committer,
'test commit',
treeid,
[repo.head.oid]
)
这是成功的,但是当我执行git status 时,我得到了这个:
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: test/test.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test/
在git reset --hard 之后,一切都修复了。
有没有办法用 pygit 正确更新索引?
【问题讨论】: