Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GitVersion is extremely slow (25 minutes) #2881

Closed
samhocevar opened this issue Oct 15, 2021 · 5 comments · Fixed by #3585
Closed

[Bug] GitVersion is extremely slow (25 minutes) #2881

samhocevar opened this issue Oct 15, 2021 · 5 comments · Fixed by #3585
Labels
Milestone

Comments

@samhocevar
Copy link

Describe the bug
Running gitversion to generate the JSON for a project is very slow; about 25 minutes.

Expected Behavior

It should not take more than a few seconds.

Steps to Reproduce

This is a private project I cannot share, unfortunately, but I can run additional tests if necessary.

Attached is a log with /diag: gitversion-log.txt

Your Environment

  • Version Used: 5.7.0+Branch.main.Sha.8d177c6d666c8eeb1c6a6a2c71fd4b78741137d2
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows 10
  • git version 2.33.1.windows.1
  • The repository has about 12,000 commits in total and 11,000 tags.
@samhocevar samhocevar added the bug label Oct 15, 2021
@samhocevar
Copy link
Author

After some more digging: this is caused by GetNumberOfUncommittedChanges, this line alone takes 25 minutes to run on my repo:

       var changes = repositoryInstance.Diff.Compare<TreeChanges>(repositoryInstance.Head.Tip.Tree,
            DiffTargets.Index | DiffTargets.WorkingDirectory);

This appears to be due to slow index performance. Subsequent calls to gitversion do not differ in run times, however running git status once in the repository causes gitversion invocations to be fast again.

As a side note, I noticed that the libgit2 binaries used by GitVersion are almost two years old.

@asbjornu
Copy link
Member

May this be related to #2864, perhaps?

@asbjornu
Copy link
Member

I don't think we expected GetNumberOfUncommittedChanges to be slow in any circumstance. The fact that git status speeds it up is both interesting and surprising. I thought the way LibGit2Sharp queried for changes was through the same mechanisms as git status. Seemingly not.

The reason we're using a 2 year old version of LibGit2Sharp is because the latest release of LibGit2Sharp is 2 years old.

@asbjornu
Copy link
Member

If an upgrade of LibGit2Sharp may help alleviate this problem, #2916 should provide useful.

@arturcic
Copy link
Member

🎉 This issue has been resolved in version 6.0.0-beta.3 🎉
The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants