How exactly use IndexEntry
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 1.7k
- 派生
- 408
- 平均合并
- 2 天 57 分钟
- 30 天内合并 PR
- 7
描述
Trying adding file with IndexEntry, this my way:
id = repo.create_blob('foo bar')
entry = pygit2.IndexEntry('zend2.txt', id, pygit2.GIT_FILEMODE_BLOB_EXECUTABLE)
repo.index.add(entry)
repo.index.write()
But with git status return this.
On branch master
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: zend2.txt
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: zend2.txt
How to add that blob to staged index.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 issue 中显示的 IndexEntry 示例和 repo.index.add/write 调用开始,然后将索引状态与显示的 git status 输出进行比较。记录或验证 stage 已创建 blob 的正确方式,并以 git status 仅报告预期的 staged 文件作为完成标志。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- git, python
- 领域
- devtools
- Issue 类型
- 文档
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100