Skip to content

[ISSUE]: Semver on release branch containing prerelease number. #4175

@Tilusch

Description

@Tilusch

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

macOS

What are you seeing?

After Upgrading my config from Gitversion 5.12.0 to 6.0.2 things broke. I use the following config after going trough the breaking changes:

tag-prefix: ""
major-version-bump-message: "(^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?(!:|:.*\\n\\n((.+\\n)+\\n)?BREAKING CHANGE:\\s.+)|^major:.*)"
minor-version-bump-message: "^(minor|feat)(\\([\\w\\s-]*\\))?:"
patch-version-bump-message: "^(patch|build|chore|ci|docs|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"

branches:
  main:
    regex: "^main$"
    mode: ManualDeployment
    is-release-branch: true
    source-branches: [ 'develop' ]
  develop:
    regex: "^develop$"
    label: alpha
    increment: Patch
    is-release-branch: false

I use a CI Pipeline to create releases when i push something to the main branch, before i got the following versions on the main branch:

{
  "Major": 2,
  "Minor": 1,
  "Patch": 1,
  "PreReleaseTag": "",
  "PreReleaseTagWithDash": "",
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": null,
  "WeightedPreReleaseNumber": 60000,
  "BuildMetaData": 1,
  "BuildMetaDataPadded": "0001",
  "FullBuildMetaData": "1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "MajorMinorPatch": "2.1.1",
  "SemVer": "2.1.1",
  "LegacySemVer": "2.1.1",
  "LegacySemVerPadded": "2.1.1",
  "AssemblySemVer": "2.1.1.0",
  "AssemblySemFileVer": "2.1.1.0",
  "FullSemVer": "2.1.1+1",
  "InformationalVersion": "2.1.1+1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "BranchName": "main",
  "EscapedBranchName": "main",
  "Sha": "63be717f5b5b8aba0df4ba607999565c734577d9",
  "ShortSha": "63be717",
  "NuGetVersionV2": "2.1.1",
  "NuGetVersion": "2.1.1",
  "NuGetPreReleaseTagV2": "",
  "NuGetPreReleaseTag": "",
  "VersionSourceSha": "8d3aabbc270b8f4072f4c9d98877dfb91e3a7d43",
  "CommitsSinceVersionSource": 1,
  "CommitsSinceVersionSourcePadded": "0001",
  "UncommittedChanges": 1,
  "CommitDate": "2024-08-22"
} 

now i get this versions on the main branch

{
  "AssemblySemFileVer": "2.1.1.0",
  "AssemblySemVer": "2.1.1.0",
  "BranchName": "main",
  "BuildMetaData": 1,
  "CommitDate": "2024-08-22",
  "CommitsSinceVersionSource": 1,
  "EscapedBranchName": "main",
  "FullBuildMetaData": "1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "FullSemVer": "2.1.1-1+1",
  "InformationalVersion": "2.1.1-1+1.Branch.main.Sha.63be717f5b5b8aba0df4ba607999565c734577d9",
  "Major": 2,
  "MajorMinorPatch": "2.1.1",
  "Minor": 1,
  "Patch": 1,
  "PreReleaseLabel": "",
  "PreReleaseLabelWithDash": "",
  "PreReleaseNumber": 1,
  "PreReleaseTag": "1",
  "PreReleaseTagWithDash": "-1",
  "SemVer": "2.1.1-1",
  "Sha": "63be717f5b5b8aba0df4ba607999565c734577d9",
  "ShortSha": "63be717",
  "UncommittedChanges": 1,
  "VersionSourceSha": "8d3aabbc270b8f4072f4c9d98877dfb91e3a7d43",
  "WeightedPreReleaseNumber": 55001
}


```### What is expected?

I would expect the semver on the mainbranch to be without the prerelease tag since its the release branch and every commit there will create a tag. 
Is this a bug or is this a new feature? 

### Steps to Reproduce

Create a git repo,  and use the config from above.

### 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