Skip to content

[ISSUE]: Main branch is not detected as main branch and produces pre-release versions #4216

@dp-sgr

Description

@dp-sgr

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

Windows

What are you seeing?

In earlier GitVersion releases we had the following workflow:

develop: produces alpha releases
release/*: produces beta releases
main: Commits on main always lead to full RTM releases. We used GitVersion to automatically tag back to the repo the newly created versions in our CI pipeline.

Version incremention strategies are made through:

  • Patches simply merge the PR on main
  • Minor/Major with either the merge from a relase branch or +semver: (major|minor)

This was achieved without any specific GitVersion config. We always used the standard.

What is expected?

I expect that every commit to the main branch is detected as RTM and not a prerelease version.

Regardless of new repos. This also doesn't work anymore on older repos with a big versioning history.

It seems like the main branch is not detected properly. (look at screenshots in "Steps to Reproduce")

Steps to Reproduce

  1. Create a new git repo with a main branch
  2. Commit a file (e.g. README)
  3. Run GitVersion

OR:
Pull my Test Repo and run GitVersion.

Here is the output of gitversion /showconfig
image

Which currently leads to the following versioning output:

{
  "AssemblySemFileVer": "0.0.1.0",
  "AssemblySemVer": "0.0.1.0",
  "BranchName": "main",
  "BuildMetaData": null,
  "CommitDate": "2024-09-19",
  "CommitsSinceVersionSource": 1,
  "EscapedBranchName": "main",
  "FullBuildMetaData": "Branch.main.Sha.0ab9e5efc330761e8bb359220505da80e337a0b8",
  "FullSemVer": "0.0.1-1",
  "InformationalVersion": "0.0.1-1+Branch.main.Sha.0ab9e5efc330761e8bb359220505da80e337a0b8",
  "Major": 0,
  "MajorMinorPatch": "0.0.1",
  "Minor": 0,
  "Patch": 1,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "1",
  "PreReleaseTagWithDash": "-1",
  "SemVer": "0.0.1-1",
  "Sha": "0ab9e5efc330761e8bb359220505da80e337a0b8",
  "ShortSha": "0ab9e5e",
  "UncommittedChanges": 0,
  "VersionSourceSha": "",
  "WeightedPreReleaseNumber": 55001
}

As you can see SemVer/FullSemVer is now 0.0.1-1 and i get a PreReleaseTag.
I expect that the output of this results in "0.0.1" without any prerelease tag as in prior GitVersion releases.

Is this a bug or do i need to explecitly configure this behavior with Gitversion 6?
If this is a configuration problem can you please tell me what i need to adjust?

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