Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into feature/VersionNumberInHotfixBranchShouldNot…
…BeIgnored
  • Loading branch information
asbjornu authored Mar 2, 2022
commit 4d055726b4415b1d2e098e48e92b20fdc538dec4
59 changes: 30 additions & 29 deletions src/GitVersion.Core.Tests/IntegrationTests/HotfixBranchScenarios.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System.Collections.Generic;
using System.Linq;
using GitTools.Testing;
using GitVersion.Core.Tests.Helpers;
using GitVersion.Extensions;
Expand Down Expand Up @@ -44,32 +42,8 @@ public void PatchLatestReleaseExample()
Commands.Checkout(fixture.Repository, "develop");
fixture.AssertFullSemver("1.3.0-alpha.1");

[Test]
public void VersionNumberInHotfixBranchShouldBeConsideredWhenPreventIncrementOfMergedBranchVersion()
{
var config = new Config
{
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag,
AssemblyFileVersioningFormat = "{MajorMinorPatch}.0",
VersioningMode = VersioningMode.ContinuousDeployment,
Branches = new Dictionary<string, BranchConfig>()
{
{ "hotfix", new BranchConfig { PreventIncrementOfMergedBranchVersion= true, Regex="r^(origin/)?hotfix[/-]" } }
}
};

const string HotfixBranch = "hotfix/1.1.1";
const string ReleaseBranch = "release/1.1.0";

using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(ReleaseBranch));
fixture.MakeACommit();
Commands.Checkout(fixture.Repository, MainBranch);
fixture.MergeNoFF(ReleaseBranch);
fixture.Repository.CreateBranch(HotfixBranch);
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.1.1-ci.1", config);
}
fixture.Repository.MergeNoFF("hotfix-1.2.1", Generate.SignatureNow());
fixture.AssertFullSemver("1.3.0-alpha.5");
}

[Test]
Expand Down Expand Up @@ -200,6 +174,34 @@ public void FeatureOnHotfixFeatureBranchDeleted()
fixture.AssertFullSemver("4.5.1-beta.2", config);
}

[Test]
public void VersionNumberInHotfixBranchShouldBeConsideredWhenPreventIncrementOfMergedBranchVersion()
{
var config = new Config
{
AssemblyVersioningScheme = AssemblyVersioningScheme.MajorMinorPatchTag,
AssemblyFileVersioningFormat = "{MajorMinorPatch}.0",
VersioningMode = VersioningMode.ContinuousDeployment,
Branches = new Dictionary<string, BranchConfig>()
{
{ "hotfix", new BranchConfig { PreventIncrementOfMergedBranchVersion= true, Regex="r^(origin/)?hotfix[/-]" } }
}
};

const string HotfixBranch = "hotfix/1.1.1";
const string ReleaseBranch = "release/1.1.0";

using var fixture = new BaseGitFlowRepositoryFixture("1.0.0");
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(ReleaseBranch));
fixture.MakeACommit();
Commands.Checkout(fixture.Repository, MainBranch);
fixture.MergeNoFF(ReleaseBranch);
fixture.Repository.CreateBranch(HotfixBranch);
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("1.1.1-ci.1", config);
}


/// <summary>
/// Create a feature branch from a hotfix branch, and merge back, but don't delete it
/// </summary>
Expand Down Expand Up @@ -251,5 +253,4 @@ public void FeatureOnHotfixFeatureBranchNotDeleted()
fixture.Repository.MergeNoFF(featureBranch, Generate.SignatureNow()); // commit 2
fixture.AssertFullSemver("4.5.1-beta.2", config);
}

}
You are viewing a condensed version of this merge commit. You can view the full changes here.