Skip to content

Slow version calculation times on freshly cloned pull request #1850

@hanzworld

Description

@hanzworld

Hi team

We have a large repository (800MB) which experiences incredibly slow GitVersion-ing when run on pull requests. However we can't understand how to fix it.

Command: gitversion.exe /output buildserver /nofetch /UpdateAssemblyInfo true
Symptom:

  • on pull request branches (e.g. refs/pull/9752/merge - which means the git repository is in a detached head state) it takes approximately 30 minutes to execute.
  • on a 'normal' branch (e.g. feature/thing) the problem does not occur and it takes between 1m30s to 2m30s.

I've worked out it's to do with the fact the repository is in a detached HEAD state. I know that GitVersion goes through a process to remedy such a scenario, and we can see this process in the logs: Begin: Normalizing git directory for branch 'refs/pull/9752/merge'. However, it according to the logs it takes < 1 minute to normalise the git directory by creating local branches, and the remaining 20+ minutes follow the "normal" GitVersion process but very, very slowly. If we rerun the same process on the same repo (not freshly cloned) it runs very quickly.

Timings on a sample run (taken straight from logs):

  • End: Normalizing git directory for branch 'refs/pull/9752/merge' (Took: 18,905.97ms)
  • End: Loading version variables from disk cache (Took: 0.74ms)
  • End: Calculating base versions (Took: 1,705,913.13ms)
  • End: Getting version tags from branch 'refs/heads/pull/9752/merge'. (Took: 7,628.48ms)
  • End: Creating dictionary (Took: 5.11ms)
  • End: Storing version variables to cache file C:\buildAgent\work\4d9ba6a2c8666e82.git\gitversion_cache\4DFE59029FF64EA34E655D9C6CBB0D781A41B4D7.yml (Took: 67.15ms)

We have tried the following with no difference.

  • Updating GitVersion from 3.0.1 to 5.0.1
  • Manually creating a branch at the specified SHA1 and checking it out prior to , so that the repository is no longer in a detached head state.

Let me know what else you need - the log is 2MB, but I'm happy to sanitize it and make available if of use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions