GitVersion: [ISSUE]: NotImplementedException in TrunkBased-Workflow

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.0-rc1

Operating system

Linux, Windows

What are you seeing?

When running gitversion on my git repos, I receive a NotImplementedException.

I was using Mainline for the past and I’m trying out the 6.0-RC1 release now.

What is expected?

A valid version description.

Steps to Reproduce

use my repos (it’s private, sorry), with the following configuration:

workflow: TrunkBased/v1
patch-version-bump-message: "^(text|fix|perf|refactor|revert|style|test)(\\([\\w\\s-]*\\))?:"

RepositoryFixture Test

No response

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

INFO [24-06-07 22:24:08:77] Applicable build agent found: 'LocalBuild'.
INFO [24-06-07 22:24:08:83] Working directory: /home/sreindl/src/mybook
INFO [24-06-07 22:24:08:83] Project root is: /home/sreindl/src/mybook/
INFO [24-06-07 22:24:08:83] DotGit directory is: /home/sreindl/src/mybook/.git
INFO [24-06-07 22:24:08:83] Branch from build environment:
INFO [24-06-07 22:24:08:84] Found configuration file at '/home/sreindl/src/mybook/GitVersion.yml'
INFO [24-06-07 22:24:08:86] -< Begin: Loading version variables from disk cache file /home/sreindl/src/mybook/.git/gitversion_cache/2E0243312D3E3098EEE3D1F4458494769E1ACE06 >-
  INFO [24-06-07 22:24:08:86] Cache file /home/sreindl/src/mybook/.git/gitversion_cache/2E0243312D3E3098EEE3D1F4458494769E1ACE06 not found.
INFO [24-06-07 22:24:08:86] -< End: Loading version variables from disk cache file /home/sreindl/src/mybook/.git/gitversion_cache/2E0243312D3E3098EEE3D1F4458494769E1ACE06 (Took: 0.51ms) >-
INFO [24-06-07 22:24:08:86] Found configuration file at '/home/sreindl/src/mybook/GitVersion.yml'
INFO [24-06-07 22:24:09:01] Using latest commit on specified branch
INFO [24-06-07 22:24:09:03] Getting tagged semantic versions. TagPrefix: [vV]? and Format: Strict
INFO [24-06-07 22:24:09:09] Running against branch: main ('16af603' - Merge pull request #250 from steven-r/dependabot/npm_and_yarn/prettier-3.3.0)
INFO [24-06-07 22:24:09:09] -< Begin: Fetching the base versions for version calculation... >-
  INFO [24-06-07 22:24:09:09] Calculating base versions for 'main'
  INFO [24-06-07 22:24:09:09] -< Begin: [Using 'ConfiguredNextVersionVersionStrategy' strategy] >-
  INFO [24-06-07 22:24:09:09] -< End: [Using 'ConfiguredNextVersionVersionStrategy' strategy] (Took: 0.51ms) >-
  INFO [24-06-07 22:24:09:09] -< Begin: [Using 'MainlineVersionStrategy' strategy] >-
    INFO [24-06-07 22:24:09:10] -< Begin: Getting tagged semantic versions on branch 'refs/heads/main'. TagPrefix: [vV]? and Format: Strict >-
    INFO [24-06-07 22:24:09:12] -< End: Getting tagged semantic versions on branch 'refs/heads/main'. TagPrefix: [vV]? and Format: Strict (Took: 15.81ms) >-
INFO [24-06-07 22:24:09:14] -< Begin: Finding branches source of 'main' >-
    INFO [24-06-07 22:24:09:14] -< End: Finding branches source of 'main' (Took: 5.23ms) >-
  INFO [24-06-07 22:24:09:77] -< End: [Using 'MainlineVersionStrategy' strategy] (Took: 673.15ms) >-
INFO [24-06-07 22:24:09:77] -< End: Fetching the base versions for version calculation... (Took: 676.90ms) >-
ERROR [24-06-07 22:24:09:78] An unexpected error occurred:
System.NotImplementedException: The method or operation is not implemented.
   at GitVersion.VersionCalculation.MainlineVersionStrategy.IterateOverCommitsRecursive(IEnumerable`1 commitsInReverseOrder, MainlineIteration iteration, IBranch targetBranch, String targetLabel, ILookup`2 taggedSemanticVersions, HashSet`1 traversedCommits) in /_/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs:line 242
 at GitVersion.VersionCalculation.MainlineVersionStrategy.GetBaseVersions(EffectiveBranchConfiguration configuration)+MoveNext() in /_/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs:line 105
   at GitVersion.VersionCalculation.NextVersionCalculator.<>c__DisplayClass14_0.<<GetNextVersions>g__GetNextVersionsInternal|0>d.MoveNext() in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 264
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at GitVersion.VersionCalculation.NextVersionCalculator.GetNextVersions(IBranch branch, IGitVersionConfiguration configuration) in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 239
   at GitVersion.VersionCalculation.NextVersionCalculator.CalculateNextVersion(IBranch branch, IGitVersionConfiguration configuration) in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 158
   at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in /_/src/GitVersion.Core/VersionCalculation/VersionCalculators/NextVersionCalculator.cs:line 53
   at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in /_/src/GitVersion.Core/Core/GitVersionCalculateTool.cs:line 45
   at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in /_/src/GitVersion.App/GitVersionExecutor.cs:line 62
INFO [24-06-07 22:24:09:78] Attempting to show the current git graph (please include in issue):
INFO [24-06-07 22:24:09:78] Showing max of 100 commits
INFO [24-06-07 22:24:09:81] *   16af603 4 days ago  (HEAD -> main, origin/main, origin/HEAD)
|\
| * c78e95a 4 days ago
* |   b059dc8 4 days ago
|\ \
| |/
|/|
| * d647992 4 days ago  (origin/dependabot/pip/tools/watchdog-4.0.1)
* |   138cd6e 4 days ago
|\ \
| * | b5fd3e3 4 days ago
* | |   f2133e2 4 days ago
|\ \ \
| * | | c85b925 4 days ago
| |/ /
* | |   d941621 4 days ago
|\ \ \
| |/ /
|/| |
| * | a806d1a 4 days ago  (origin/dependabot/pip/tools/python-dateutil-2.9.0.post0)
| |/
* |   a7eb2de 4 days ago
|\ \
| * | cab75cb 4 days ago
|/ /
* |   f7ab2bc 4 days ago
|\ \
| * | fe6dd26 4 days ago  (origin/dependabot/npm_and_yarn/semantic-release-24.0.0)
| |/
* |   379206f 4 days ago
|\ \
| * | 32ef5c1 4 days ago  (origin/dependabot/pip/tools/textual-0.64.0)
| |/
* | 4cbde78 4 days ago
* | 313c6a6 4 days ago
* | 8eedad5 4 days ago
* | 2b788e3 4 days ago
* | 1d16749 4 days ago
* | f8c9588 4 days ago
* | b675960 4 days ago
* | ad68f4c 5 days ago
|/
| * e924596 4 days ago  (origin/dependabot/pip/tools/sphinx-design-0.6.0)
|/
| * 11ea42c 4 days ago  (origin/dependabot/npm_and_yarn/typescript-5.4.5)
|/
| * 11785ed 4 days ago  (origin/dependabot/npm_and_yarn/prettier-3.3.0)
|/
| * c523a3e 4 days ago  (origin/dependabot/npm_and_yarn/conventional-changelog-conventionalcommits-8.0.0)
|/
* 095d235 5 days ago
* 1822eee 5 days ago
* 159b2de 5 days ago
* c467070 5 days ago
* 1c4511a 6 days ago
* b7d5a6e 6 days ago
* 54b0852 6 days ago
* 23db9fe 6 days ago
* e2127f2 6 days ago
* 3eafa11 6 days ago
* 1ad7fff 6 days ago
* 0413fe7 6 days ago
* be3e0b1 8 days ago
*   cc15698 8 days ago
*   cc15698 8 days ago
|\
| * d45724f 8 days ago
|/
*   c4ed833 8 days ago
|\
| * caba933 8 days ago
|/
*   bc10604 8 days ago
|\
| * d354534 4 months ago  (origin/dependabot/npm_and_yarn/prettier-3.2.5)
* |   33783ca 8 days ago
|\ \
| * | d192163 4 months ago  (origin/dependabot/npm_and_yarn/ip-2.0.1)
| |/
* |   b1d0618 8 days ago
|\ \
| * | 25098ac 8 days ago
* | |   a73a888 8 days ago
|\ \ \
| |/ /
|/| |
| * | 76d3474 8 days ago
* | |   33f72ce 8 days ago
|\ \ \
| |/ /
|/| |
| * | fb3290c 8 days ago
|/ /
* | dc2eb0b 12 days ago
* | dc229a8 12 days ago
* | 6bcd747 12 days ago
* | 882c286 12 days ago
* | 2a12144 12 days ago
* | 530eb9d 2 weeks ago
* | 2f8b873 2 weeks ago
* | 425c70b 2 weeks ago
|/
| * c6601dc 10 weeks ago  (origin/dependabot/pip/tools/textual-0.55.0)
|/
| * 481f0fb 2 months ago  (origin/dependabot/npm_and_yarn/semantic-release-23.0.6)
|/
| * bee859f 2 months ago  (origin/dependabot/pip/tools/urwid-2.6.10)
|/
| * 783d5f4 3 months ago  (origin/dependabot/pip/tools/setuptools-69.2.0)
|/
| * a868f1e 3 months ago  (origin/dependabot/pip/tools/pandas-2.2.1)
|/
| * 407aec3 3 months ago  (origin/dependabot/npm_and_yarn/eslint-8.57.0)
|/
| * 6a92988 4 months ago  (origin/dependabot/npm_and_yarn/markdownlint-cli-0.39.0)
|/
| * 9fdb4b2 5 months ago  (origin/dependabot/pip/tools/jinja2-3.1.3)
|/
| * a333d63 5 months ago  (origin/dependabot/pip/tools/humanize-4.9.0)
|/
*   d90c696 5 months ago
|\
| * 3a5505d 5 months ago
|/
*   0540c52 5 months ago
|\
| * 440e8f6 5 months ago
* |   1f401cb 5 months ago
|\ \
| |/
|/|
| * 83779f0 5 months ago
|/
*   5271152 5 months ago
|\
| * 97a7f28 5 months ago
|/
*   6be3236 5 months ago
|\
| * 907fe08 6 months ago
* |   be2f03c 5 months ago
|\ \
| * | e1f6ab0 6 months ago
| |/
* |   860a2b5 5 months ago
|\ \
| * | 205ad0d 6 months ago
| |/
* |   4a5116c 5 months ago
|\ \
| * | 57760c5 7 months ago
| |/
* |   9484cc8 5 months ago
|\ \
| * | 7e3cf6d 7 months ago
| |/
* |   ed7e81a 5 months ago
|\ \
| * | dcfd8e3 6 months ago
| |/
* |   22e49e4 5 months ago
|\ \
| |/
|/|
| * 6234f1d 5 months ago
|/
*   b2d7db0 7 months ago
|\
| *   e35f3a7 7 months ago
| |\
| | * 3d790ff 7 months ago
| * |   b65376f 7 months ago
| |\ \
| | * | fb30953 8 months ago
| | |/
| * |   dde8119 7 months ago
| |\ \

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 10
  • Comments: 19 (5 by maintainers)

Most upvoted comments

I’ve just managed to replicate it.

  • I pull main
  • Someone else commits and pushes to main
  • I commit and push to main, but don’t have the latest now
  • Git merges latest for me and makes a commit with a message "[Merge remote-tracking branch ‘origin/main’]
  • GitVersion now fails with exception

Git Log output:

*   b4587d0 2 minutes ago  (HEAD -> main, origin/main, origin/HEAD)
|\
| * d8d918b 3 minutes ago
* | b69156a 2 minutes ago
|/
* c6c2e05 5 minutes ago
* 47c20f6 2 days ago
* df3ed2f 2 days ago
* 794b50f 2 days ago

Repository you can test with: https://github.com/thomhurst/GitVersionExceptionRepro

Can we re-open this? I know you say pull requests welcome but I don’t have enough knowledge on how the algorithms or what-not work to generate everything, otherwise I’d try and contribute.

This is unfortunately still affecting a lot of my pipelines if things get merged without rebasing in-between.

One workaround is to just go back to version 5.x. It still generally works fine, including for this case

For now, we ended up just forking it internally for dependency updates

I’m stuck with the same problem on repositories with merge message. At the moment using track-merge-message: false fix the issue.