libgit2 / libgit2/libgit2sharp
Repository.Commits.QueryBy is missing changes
还没有人认领这个 Issue。
- 主要语言
- C#
- 星标
- 3.5k
- 派生
- 925
- PR 合并指标
- 30 天内没有已合并 PR
描述
Reproduction steps
This seems to have been brought up a couple of times already (a quick search showed #1401, #1591, https://github.com/libgit2/libgit2sharp/pull/963#issuecomment-355674649).
This is pretty weird: QueryBy returns 0 LogEntries, while going through all commits and diffing to the previous one shows the same changes/additions/renames as e.g. the SourceTree or Fork UI for the exact same path as for the QueryBy call.
Note that it only does that for some files, most files work fine. I haven't found a common pattern so far (e.g. specific characters, or only merges, or ...) but it looks like QueryBy is omitting merges and that might cause problems.

(commits in reverse order)
Expected behavior
QueryBy should return all changes to the file (as outlined in #963 where it was originally added).
Actual behavior
QueryBy returns 0 LogEntries.
Version of LibGit2Sharp (release number or SHA1)
git2-106a5f2
Operating system(s) tested; .NET runtime tested
Win 10, .NET 4.6
EDIT: Maybe I'm understanding the code wrong, but taking a quick peek at https://github.com/libgit2/libgit2sharp/blob/master/LibGit2Sharp/Core/FileHistory.cs#L137, I think QueryBy in fact ignores all commits that have more than 1 parent (e.g. all merges).
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Windows/.NET 4.6 上重现受影响路径缺失的 LogEntries,并将 QueryBy 与 issue 中描述的所有提交 diff 方法进行比较。阅读 LibGit2Sharp/Core/FileHistory.cs 第 137 行附近的代码,重点关注如何处理具有多个父提交的提交。当 QueryBy 返回受影响文件的所有变更(包括与合并相关的变更)时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- csharp, git
- 领域
- devtools
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100