libgit2 / libgit2/libgit2sharp

Diff compare with DiffTargets.WorkingDirectory is terribly slow

未关闭
#2,010 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
C#
星标
3.5k
派生
925
PR 合并指标
30 天内没有已合并 PR

描述

Reproduction steps

Compare commit to the working tree directory on a relatively big repository

 repository.Diff.Compare<TreeChanges>(
              repository.Head.Tip.Tree,
              DiffTargets.WorkingDirectory)

which takes a long time or never completes. Comparing the working trees of two commits works instantly

                    var branchDiffResult = repository.Diff.Compare<TreeChanges>(
                       targetCommit.Tree,
                        repository.Head.Tip.Tree,
                        compareOptions);

Additionally, doing repository.RetrieveStatus() is also slow, but not that slow.

Expected behavior

The speed of the two matches.

Actual behavior

Comparing to working directory is terribly slow.

Version of LibGit2Sharp (release number or SHA1)

0.27.0.0

Operating system(s) tested; .NET runtime tested

4.72, windows 11

贡献指南

打开贡献指南

从这里开始

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

调研方向

在一个相对较大的 repository 上使用 repository.Diff.Compare(repository.Head.Tip.Tree, DiffTargets.WorkingDirectory) 重现性能变慢的问题,然后将其与 commit-to-commit 重载和 repository.RetrieveStatus() 进行比较。跟踪工作目录比较路径,并测量时间花费在哪里。当工作目录比较以与 commit-to-commit 比较相当的性能完成时,即表示完成。

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

评估

技术栈
csharp, git
领域
backend-api-design, performance
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

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