libgit2 / libgit2/pygit2

how to diff one file in working dir against a Blob?

未关闭
#604 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

feature
主要语言
Python
星标
1.7k
派生
408
平均合并
2 天 57 分钟
30 天内合并 PR
7

描述

pygit2 version python3-pygit2-0.23.3-2.fc23.x86_64

I cannot figure out how I can get a diff for only one file.

How do I arrange to have pygit2 return the diff of a Blob against the working dir file?

I looked at calling diff_to_working on a new Index(), but that fails because the new Index() does not
self._repo filled in.

TreeBuilder() seems is unable to help as it requires putting tree objects into the repo to allow
for the folder structure, for example to diff Source/file.py. needs a tree for Source. I clearly
do not want to be writting files into the repo to do a diff.

Did I miss something in API?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先查看 issue 中提到的 diff_to_working 和 Index API,以及 pygit2 如何表示 Blob 和工作目录文件。确定是否存在支持此比较的现有 API,且无需创建 repository tree 对象;当确定或指定出一条支持单个 Blob 与工作树之间 diff 的路径时,即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
git, python
领域
devtools
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。