Skip to content

[Bug] GitVersion no longer calculates version correctly for mainline modeΒ #2441

@techgeek03

Description

@techgeek03

Describe the bug
Since version 5.5 when using Mainline mode GitVersion is not calculating the version at all and it gives ether the value in next-version or the version from the last tag.

Expected Behavior

To have correct version

Actual Behavior

Version is stacked at next-version or the version from the last tag

Steps to Reproduce

Here is a simple GitVersion.yaml file I have been using

mode: Mainline
next-version: 1.0.0
branches:
  feature:
    tag: beta.{BranchName}
ignore:
  sha: []
merge-message-formats: {}

After many commits in master branch this is the output of GitVersion

INFO [10/29/20 23:06:38:48] Dumping commit graph:
INFO [10/29/20 23:06:38:64] *   3cdb26c 23 minutes ago  (HEAD -> master)
|\
| * 41f9c14 24 minutes ago  (feature/y2)
|/
*   9367673 73 minutes ago
|\
| * eb5c77a 76 minutes ago  (feature/test)
|/
* f957b18 78 minutes ago  (tag: 1.1.0)
* 318e307 79 minutes ago

INFO [10/29/20 23:06:38:98] Using latest commit on specified branch
INFO [10/29/20 23:06:39:02] Running against branch: master (3cdb26cf21767b34a3ecc65662fa00717857100a)
INFO [10/29/20 23:06:39:02] Begin: Calculating base versions
  INFO [10/29/20 23:06:39:07] NextVersion in GitVersion configuration file: 1.0.0 with commit count source External Source
  INFO [10/29/20 23:06:39:16] Git tag '1.1.0': 1.1.0 with commit count source f957b18b8557ba7d40a4e7a1a72f160c250e386f
  INFO [10/29/20 23:06:39:18] Found multiple base versions which will produce the same SemVer (1.1.1), taking oldest source for commit counting (Git tag '1.1.0')
  INFO [10/29/20 23:06:39:18] Base version used: Git tag '1.1.0': 1.1.0 with commit count source f957b18b8557ba7d40a4e7a1a72f160c250e386f
  INFO [10/29/20 23:06:39:18] End: Calculating base versions (Took: 158.30ms)
  INFO [10/29/20 23:06:39:18] Begin: Using mainline development mode to calculate current version
    INFO [10/29/20 23:06:39:20] Found possible mainline branches: master
    INFO [10/29/20 23:06:39:20] Mainline for current branch is master
    INFO [10/29/20 23:06:39:20] 4 commits found between f957b18b8557ba7d40a4e7a1a72f160c250e386f and 3cdb26cf21767b34a3ecc65662fa00717857100a
  INFO [10/29/20 23:06:39:21] End: Using mainline development mode to calculate current version (Took: 23.36ms)
{
  "Major":1,
  "Minor":1,
  "Patch":0,
  "PreReleaseTag":4,
  "PreReleaseTagWithDash":"",
  "PreReleaseLabel":"",
  "PreReleaseNumber":"",
  "WeightedPreReleaseNumber":60000,
  "BuildMetaData":"",
  "BuildMetaDataPadded":"",
  "FullBuildMetaData":"Branch.master.Sha.3cdb26cf21767b34a3ecc65662fa00717857100a",
  "MajorMinorPatch":"1.1.0",
  "SemVer":"1.1.0",
  "LegacySemVer":"1.1.0",
  "LegacySemVerPadded":"1.1.0",
  "AssemblySemVer":"1.1.0.0",
  "AssemblySemFileVer":"1.1.0.0",
  "FullSemVer":"1.1.0",
  "InformationalVersion":"1.1.0+Branch.master.Sha.3cdb26cf21767b34a3ecc65662fa00717857100a",
  "BranchName":"master",
  "EscapedBranchName":"master",
  "Sha":"3cdb26cf21767b34a3ecc65662fa00717857100a",
  "ShortSha":"3cdb26c",
  "NuGetVersionV2":"1.1.0",
  "NuGetVersion":"1.1.0",
  "NuGetPreReleaseTagV2":"",
  "NuGetPreReleaseTag":"",
  "VersionSourceSha":"f957b18b8557ba7d40a4e7a1a72f160c250e386f",
  "CommitsSinceVersionSource":4,
  "CommitsSinceVersionSourcePadded":"0004",
  "UncommittedChanges":1,
  "CommitDate":"2020-10-29"
}
  INFO [10/29/20 23:06:39:26] Done writing

I tried using main as default branch as well but it had the same problem.

Context

We are using GitVersion in all our Azure DevOps pipelines and we have configured the pipeline task to use the latest version of GitVersion, so currently all our pipelines are reporting wrong versions.

Your Environment

  • Version Used: 5.5
  • Operating System and version (Windows 10, Ubuntu 18.04): Windows, OS X, Ubuntu 18.04

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