GitVersion: [ISSUE]: GitVersion tool is slow / stalls

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

GitVersion.Tool

GitVersion version

6.0.2

Operating system

Linux

What are you seeing?

This is for

      git status
      dotnet gitversion /version
      dotnet gitversion $(Build.SourcesDirectory) /output buildserver /nofetch

on Azure DevOps pipelines (git status only added for testing and because some old issue mentioned that the index might be the culprit).

I am seeing a “pause” in the log - and it always happens for the current PRs branch (pull/2271/merge) End and the Begin of the actual branch I created comparing to develop (GitFlow). Below are two runs, as you can see it seems to wait for 3 minutes for no reason at all.

2024-08-13T07:24:15.4623771Z     INFO [24-08-13 7:24:15:46] -< End: Finding merge base between 'pull/2271/merge' and 'origin/release/4.77.0'. (Took: 0.43ms) >-
2024-08-13T07:24:15.4667782Z   INFO [24-08-13 7:24:15:46] -< End: Finding branches source of 'pull/2271/merge' (Took: 368.42ms) >-
2024-08-13T07:27:26.9638056Z   INFO [24-08-13 7:27:26:96] -< Begin: Finding branches source of 'feature/gitversionperftest' >-
2024-08-13T07:27:26.9666509Z     INFO [24-08-13 7:27:26:96] -< Begin: Finding merge base between 'feature/gitversionperftest' and 'develop'. >-

2024-08-13T07:36:02.1232132Z     INFO [24-08-13 7:36:02:12] -< End: Finding merge base between 'pull/2271/merge' and 'origin/release/4.77.0'. (Took: 0.40ms) >-
2024-08-13T07:36:02.1277016Z   INFO [24-08-13 7:36:02:12] -< End: Finding branches source of 'pull/2271/merge' (Took: 376.28ms) >-
2024-08-13T07:39:15.4620032Z   INFO [24-08-13 7:39:15:46] -< Begin: Finding branches source of 'feature/gitversionperftest' >-
2024-08-13T07:39:15.4648616Z     INFO [24-08-13 7:39:15:46] -< Begin: Finding merge base between 'feature/gitversionperftest' and 'develop'. >-

This also already happened for 6.0.0, I was testing 6.0.2 to see if there would be a difference.

I scrolled all "Took: " and I found one sore thumb:

2024-08-13T07:39:19.2643763Z INFO [24-08-13 7:39:19:26] -< End: Fetching the base versions for version calculation... (Took: 197,524.02ms) >-

However, that would never add up because no other Took: ever exceeded low 100s of ms, most of them were single digit.

INFO [24-08-13 7:36:00:97] -< Begin: Normalizing git directory for branch 'refs/pull/2271/merge' >-
  INFO [24-08-13 7:36:01:00] One remote found (origin -> 'https://someazdourlredacted/myrepo').
  INFO [24-08-13 7:36:01:00] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories
  INFO [24-08-13 7:36:01:01] Creating local branch pull/2271/merge pointing at d4d958b
and then a lot more Creating local branch

What is expected?

Of couse not seeing the pause.

Steps to Reproduce

Not sure if that reproduces outside of our project.

RepositoryFixture Test

No response

Output log or link to your CI build (if appropriate).

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (11 by maintainers)

Most upvoted comments

I tried 6.0.3 - really impressive! From north of eight minutes down to less than half a minute! Thanks a bunch!

I’d say thank you to @david-driscoll

I think we better spent the time now to improve the lazy loading/ reset the cached collection, for all git object collections we have than just the one that is in this PR just for the sake of having this merged. So if the author is willing to continue the improving the git object collections loading, then we can help with that, otherwise I would rather improve it myself when I find some time.