Skip to content

Forced push breaks GitVersion #4052

@mihaicodrean

Description

@mihaicodrean

Prerequisites

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

GitVersion package

GitVersion.MsBuild

GitVersion version

5.12.0

Operating system

Windows

What are you seeing?

I have the requirement to build an old clone of NHibernate.Search under TeamCity with msbuild, but GitVersion bails out with (log sanitized):

[Project "NHibernate.Search.csproj"]   Couldn't find any remote tips from remote 'https://github.com/nhibernate/NHibernate-Search.git' pointing at the commit '996fde9cd417a4e11d80067c7a1ec34e2d761ec4'
[MSBuild] C:\Users\<teamcity-user>\.nuget\packages\gitversion.msbuild\5.12.0\tools\GitVersion.MsBuild.targets(9,9): error MSB3073: The command ""C:\Users\<teamcity-user>\.nuget\packages\gitversion.msbuild\5.12.0\tools\net48/gitversion.exe" "[...] TeamCity\buildAgent\[...]\NHibernate.Search\src\NHibernate.Search"  -output file -outputfile obj\gitversion.json" exited with code 1.

And that's because that commit no longer exists, being lost with the Forced Push here:

chore(deps): update dependency nhibernate to v5.5.1 Force push
renovate[bot] force pushed to renovate/nhibernate-5.x • 996fde9…063356c • on Mar 29

I should mention that the command above succeeds if not run under TeamCity, e.g. indirectly from Visual Studio or at a command prompt, probably because it identifies the branch by path, and not insisting on finding that exact commit.

Is there a workaround, say to make GitVersion operate the same way under TeamCity?

What is expected?

GitVersion should fallback to identifying the brach by path.

Steps to Reproduce

Already described.

RepositoryFixture Test

No response

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

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions