GitVersion
GitVersion copied to clipboard
[ISSUE]: Mainline in 6.0.0 with default configuration values throws
Prerequisites
- [X] I have written a descriptive issue title
- [X] I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.Tool, GitVersion.MsBuild
GitVersion version
6.0.0
Operating system
Linux
What are you seeing?
Using mainline strategy, when building on github in a PR, it says:
An orphaned branch 'origin/feature/name-of-branch' has been detected and will be skipped=True.
And a bit further I get:
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at GitVersion.VersionCalculation.MainlineVersionStrategy.GetCommitsWasBranchedFrom(IBranch branch, IBranch[] excludedBranches) in /_/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/MainlineVersionStrategy.cs:line 299
I am using the default configuration except for adding mainline strategy.
The issue seems to be that the parent of the pr branch created by github, is my branch which is being built, and it match to the pull-request branch configuration. That branch configuration has an inherit increment, and when mainline is trying to go up from my pr branch to find a main, it hits that pull-request level, which in default configuration, does NOT have the is-main-branch
value set and it makes it throw.
What is expected?
I expect default configuration not to throw.
Adding the missing is-main-branch
makes it work, so it would be nice if the default configuration had it. Here is the complete configuration that made it work. (All other branches configurations have that attribute ... probably just forgot it on pull request?)
strategies:
- Fallback
- ConfiguredNextVersion
- MergeMessage
- TaggedCommit
- TrackReleaseBranches
- VersionInBranchName
- Mainline
branches:
pull-request:
is-main-branch: false
Steps to Reproduce
Build a pull request on GitHub with this configuration:
strategies:
- Fallback
- ConfiguredNextVersion
- MergeMessage
- TaggedCommit
- TrackReleaseBranches
- VersionInBranchName
- Mainline
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response