Description
Describe the bug
The following test
[Test]
public void With_numbered_release_branch()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.Checkout(MainBranch);
fixture.Repository.ApplyTag("1.2.1");
fixture.BranchTo("develop");
fixture.Repository.MakeACommit("to be released");
fixture.BranchTo("release/1.3.0");
fixture.Repository.MakeCommits(1);
fixture.Repository.ApplyTag("1.3.0-beta.1");
fixture.Checkout("develop");
fixture.Repository.MakeACommit("new development");
fixture.AssertFullSemver("1.4.0-alpha.1");
}
produces
@startuml
create participant main
note over "main" #D3D3D3
1.2.1
end note
create participant develop
main -> develop: branch from main
create participant "release/1.3.0"
develop -> "release/1.3.0": branch from develop
note over "release/1.3.0" #D3D3D3
1.3.0-beta.1
end note
note over develop #D3D3D3
1.4.0-alpha.1
end note
@enduml
with a final version on develop
of 1.4.0-alpha.1
. This is as expected and documented in the minor release branches example for gitflow.
In our case, we use conventional commits and bump our version based on those. Therefore, we do not use numbered release branches, but give them random names as exemplified by the following test
[Test]
public void MyTest()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.Checkout(MainBranch);
fixture.Repository.ApplyTag("1.2.1");
fixture.BranchTo("develop");
fixture.Repository.MakeACommit("semver: feature");
fixture.BranchTo("release/some_release");
fixture.Repository.MakeCommits(1);
fixture.Repository.ApplyTag("1.3.0-beta.1");
fixture.Checkout("develop");
fixture.Repository.MakeACommit("semver: feature");
fixture.AssertFullSemver("1.4.0-alpha.1");
}
However, this test fails by producing 1.3.0-alpha.2
, as shown below
@startuml
create participant main
note over "main" #D3D3D3
1.2.1
end note
create participant develop
main -> develop: branch from main
create participant "release/some_release"
develop -> "release/some_release": branch from develop
note over "release/some_release" #D3D3D3
1.3.0-beta.1
end note
note over develop #D3D3D3
1.3.0-alpha.2
end note
@enduml
Expected Behavior
I would expect the test to produce 1.4.0-alpha.1
Actual Behavior
The test produces 1.3.0-alpha.2
Possible Fix
I suspect the issue is that the versioning is based on the release branch name instead of the tag on the release branch. By changing the logic to target the tag on the release branch, the correct version might be created.
Steps to Reproduce
See above
Context
See above
Your Environment
- Version Used: d0a673a
- Operating System and version (Windows 10, Ubuntu 18.04): Windows 10
Link to your project:Link to your CI build (if appropriate):
Notes
If this is actually found to be a bug, I would be happy to provide a pull request to fix it.