Skip to content

StackOverflow exception while using increment: Inherit config, and branches merging #2034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #3445
dzenchar opened this issue Jan 13, 2020 · 3 comments
Closed
Tracked by #3445
Labels

Comments

@dzenchar
Copy link

dzenchar commented Jan 13, 2020

Hello,

I encountered an issue while using the latest beta version GitVersion v5.1.4-beta1.48.
The problem is that, the GitVersion task falls into stack overflow after the following scenario:

  1. There are two branches master and dev (master is the source branch for dev)
  2. Push some change-set into the master branch. master increments version patch number
  3. Merge changes from master into dev
  4. Run GitVersion.exe onto dev branch -> stack overflow exception

My GitVersion.yml:

assembly-versioning-scheme: MajorMinorPatch
mode: Mainline
tag-prefix: '[vV]'
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
commit-message-incrementing: Enabled
branches:
  hotfix:
    regex: hotfix?[/-]
    tag: useBranchName
  feature:
    regex: feature?[/-]
  develop:
    regex: ^dev(elop)?(ment)?$
    tag: alpha
    increment: Inherit
    prevent-increment-of-merged-branch-version: false
    track-merge-target: true
  master:
    increment: Patch
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
ignore:
  sha: []
merge-message-formats: {}

I've tried both GitVersion.exe as well as GitVersion MSBuild task.
Log:

GitVersionTask.targets(10,9): warning : 2020-01-13 15:51:53		    WARN [01/13/20 15:51:53:30] Failed to inherit Increment branch configuration, no branches found.
GitVersionTask.targets(10,9): warning : 
GitVersionTask.targets(10,9): warning : Falling back to dev branch config
GitVersionTask.targets(10,9): warning :
GitVersionTask.targets(10,9): warning : 2020-01-13 15:51:53		      WARN [01/13/20 15:51:53:31] Failed to inherit Increment branch configuration, no branches found.
GitVersionTask.targets(10,9): warning : 
GitVersionTask.targets(10,9): warning : Falling back to dev branch config
GitVersionTask.targets(10,9): warning :
GitVersionTask.targets(10,9): warning : 2020-01-13 15:51:53		        WARN [01/13/20 15:51:53:32] Failed to inherit Increment branch configuration, no branches found.
GitVersionTask.targets(10,9): warning : 
GitVersionTask.targets(10,9): warning : Falling back to dev branch config
GitVersionTask.targets(10,9): warning :
GitVersionTask.targets(10,9): warning : 2020-01-13 15:51:53		          WARN [01/13/20 15:51:53:32] Failed to inherit Increment branch configuration, no branches found.
GitVersionTask.targets(10,9): warning : 
GitVersionTask.targets(10,9): warning : Falling back to dev branch config
GitVersionTask.targets(10,9): warning :
GitVersionTask.targets(10,9): warning : 2020-01-13 15:51:53		            WARN [01/13/20 15:51:53:33] Failed to inherit Increment branch configuration, no branches found.
...

An image of my Git graph:
git-history

P.S. There is a workaround, if I disable inheritance on develop branch:

develop:
    increment: **None**

But this case the develop branch don't use a version number from master.

@dzenchar dzenchar changed the title StackOverflow exception while using tncrement: Inherit config, and branches merging StackOverflow exception while using increment: Inherit config, and branches merging Jan 13, 2020
@dzenchar
Copy link
Author

I was also able to reproduce the issue with the following simplified config:

assembly-versioning-scheme: MajorMinorPatch
mode: Mainline
branches: 
  master:
    increment: Patch
  develop:
    increment: Inherit
ignore:
  sha: []
merge-message-formats: {}

@asbjornu
Copy link
Member

Are you able to reproduce this in a RepositoryFixture test? If so, this should be pretty simple to fix. A PR with such a test would be warmly welcomed.

[Test]
public void VerifyPullRequestsActLikeContinuousDelivery()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit("1");
fixture.MakeATaggedCommit("1.0.0");
fixture.MakeACommit();
fixture.AssertFullSemver(config, "1.0.1");
fixture.BranchTo("feature/foo", "foo");
fixture.AssertFullSemver(config, "1.0.2-foo.0");
fixture.MakeACommit();
fixture.MakeACommit();
fixture.Repository.CreatePullRequestRef("feature/foo", "master", normalise: true, prNumber: 8);
fixture.AssertFullSemver(config, "1.0.2-PullRequest0008.3");
}

@stale
Copy link

stale bot commented Apr 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants