libgit2 / libgit2sharp

Git + .NET = ❤
http://libgit2.github.com
MIT License
3.12k stars 878 forks source link

Diff compare with DiffTargets.WorkingDirectory is terribly slow #2010

Open kboom opened 1 year ago

kboom commented 1 year ago

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

LJN-hzleaper commented 1 year ago

I encounter the same problem.