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

GitVersion is incredibly slow on detached head #694

Closed
ramonsmits opened this issue Oct 15, 2015 · 14 comments
Closed

GitVersion is incredibly slow on detached head #694

ramonsmits opened this issue Oct 15, 2015 · 14 comments

Comments

@ramonsmits
Copy link

When opening a solution on a detached head it takes ages to open due to GitVersionTask.

This often happens when you are rebasing and you want to edit a previous commit.

For some reason this is affecting VS2015 more then VS2013.

It takes minutes to load a solution and during that time VS is not responsive. This happens then for each rebase step. I simple rebase where you want to validate before committing takes ages.

After loading I also need to build it which also takes ages.

With the NServiceBus solution on a hotfix branch it can easily take more than 5 minutes on a macbook pro i7 2.5GHz if not 10.

@gep13
Copy link
Member

gep13 commented Oct 15, 2015

Is the same true when using GitVersionTask 3.2.0? Would it be possible for you to try with the new version?

@pascalberger
Copy link
Member

3.3.0 contains some performance improvements. Is this still an issue?

@ramonsmits
Copy link
Author

I'll verify the performance with a later version this week.

@JakeGinnivan
Copy link
Contributor

Going to close this, please create a new issue if you still have perf issues and we can look into it further.

@timbussmann
Copy link

Can confirm this is still an issue with version 3.4.1

@asbjornu
Copy link
Member

@timbussmann Do you have any details? Is the repository you're testing this on public perchance so we can verify?

@asbjornu asbjornu reopened this Jun 29, 2016
@asbjornu asbjornu changed the title GitVersionTask 2.0.1 incredibly slow on detached head GitVersion is incredibly slow on detached head Jun 29, 2016
@ramonsmits
Copy link
Author

@asbjornu
Copy link
Member

@ramonsmits Is it a problem with gitversion.exe too? That's a bit easier to test.

@asbjornu
Copy link
Member

It would also be interesting to know how you're able to actually get a version number out of GitVersion, since GitVersionFinder.EnsureHeadIsNotDetached() should ensure that the commit isn't a detached head by throwing an exception.

@timbussmann
Copy link

@asbjornu so I was able to reproduce it by rebasing some branch with multiple commits with merge conflicts. So after the first rebased commit I hit the issue as soon as the rebase stops because of a merge conflicts occurs.

I think GitVersionFinder.EnsureHeadIsNotDetached() works since I get these outputs:

2>MSBUILD : warning : WARN [06/29/16 17:16:03:33] Could not determine assembly version: GitVersion.WarningException: It looks like the branch being examined is a detached Head pointing to commit 'd3a2363'. Without a proper branch name GitVersion cannot determine the build version.
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureHeadIsNotDetached(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureMainTopologyConstraints(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteInternal(String targetBranch, String commitId, IRepository repo, GitPreparer gitPreparer, String projectRoot, IBuildServer buildServer)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication)
2>MSBUILD : warning : WARN [06/29/16 17:16:35:06] Could not determine assembly version: GitVersion.WarningException: It looks like the branch being examined is a detached Head pointing to commit 'd3a2363'. Without a proper branch name GitVersion cannot determine the build version.
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureHeadIsNotDetached(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureMainTopologyConstraints(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteInternal(String targetBranch, String commitId, IRepository repo, GitPreparer gitPreparer, String projectRoot, IBuildServer buildServer)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication)
2>MSBUILD : warning : WARN [06/29/16 17:17:08:38] Could not determine assembly version: GitVersion.WarningException: It looks like the branch being examined is a detached Head pointing to commit 'd3a2363'. Without a proper branch name GitVersion cannot determine the build version.
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureHeadIsNotDetached(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.EnsureMainTopologyConstraints(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.GitVersionFinder.FindVersion(GitVersionContext context)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteInternal(String targetBranch, String commitId, IRepository repo, GitPreparer gitPreparer, String projectRoot, IBuildServer buildServer)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.ExecuteGitVersion(String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)
2>MSBUILD : warning :    at GitVersion.ExecuteCore.TryGetVersion(String directory, VersionVariables& versionVariables, Boolean noFetch, Authentication authentication)

as you can see from the timestamps it takes ~30 secs between each entry which we get for every project in the solution, making a build take multiple minutes.

@asbjornu
Copy link
Member

@timbussmann Aha. So EnsureHeadIsNotDetached() is throwing, but it's still taking ages to get to the point where the detached head check is being performed. I see. I have to wonder what exactly is taking so long inbetween there, though. Do you think it's possible to set Verbosity to Diagnostic in MSBuild while running this (on the command line) and pasting here what is then being logged? Thanks!

@timbussmann
Copy link

timbussmann commented Jun 30, 2016

@asbjornu I uploaded a gist of the build log here: https://gist.github.com/timbussmann/939f433cc7894ba43cb92b1dd1f7780c

@asbjornu
Copy link
Member

asbjornu commented Jul 1, 2016

@timbussmann Thanks for that. I've merged #919 to improve the logging we do in that area of the code. Could you please clone the GitVersion repository, run ./build.cmd and copy GitVersion.exe from build/* to wherever it is you can re-run this so we can have a new look at the build log? That would be incredibly useful! 😄

simonejsing pushed a commit to simonejsing/GitVersion that referenced this issue Jul 7, 2016
@asbjornu
Copy link
Member

asbjornu commented Mar 1, 2019

There hasn't been any recent reports of slowness, so I'll close this as "accidentally fixed". 😅

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

No branches or pull requests

6 participants