Skip to content

Commit 7e47d44

Browse files
author
Oren Novotny
committed
Fix develop matching developer; add support for dev to be recognized the same way as develop
1 parent ba2158d commit 7e47d44

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

src/GitVersionCore.Tests/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ branches:
4444
increment: Patch
4545
prevent-increment-of-merged-branch-version: true
4646
track-merge-target: false
47-
develop:
47+
dev(elop)?(ment)?$:
4848
mode: ContinuousDeployment
4949
tag: unstable
5050
increment: Minor

src/GitVersionCore.Tests/ConfigProviderTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ public void OverwritesDefaultsWithProvidedConfig()
7575
const string text = @"
7676
next-version: 2.0.0
7777
branches:
78-
develop:
78+
dev(elop)?(ment)?$:
7979
mode: ContinuousDeployment
8080
tag: dev";
8181
SetupConfigFileContent(text);
8282
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
8383

8484
config.NextVersion.ShouldBe("2.0.0");
85-
config.Branches["develop"].Increment.ShouldBe(defaultConfig.Branches["develop"].Increment);
86-
config.Branches["develop"].VersioningMode.ShouldBe(defaultConfig.Branches["develop"].VersioningMode);
87-
config.Branches["develop"].Tag.ShouldBe("dev");
85+
config.Branches["dev(elop)?(ment)?$"].Increment.ShouldBe(defaultConfig.Branches["dev(elop)?(ment)?$"].Increment);
86+
config.Branches["dev(elop)?(ment)?$"].VersioningMode.ShouldBe(defaultConfig.Branches["dev(elop)?(ment)?$"].VersioningMode);
87+
config.Branches["dev(elop)?(ment)?$"].Tag.ShouldBe("dev");
8888
}
8989

9090
[Test]
@@ -117,7 +117,7 @@ public void CanReadDefaultDocument()
117117
SetupConfigFileContent(text);
118118
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
119119
config.AssemblyVersioningScheme.ShouldBe(AssemblyVersioningScheme.MajorMinorPatch);
120-
config.Branches["develop"].Tag.ShouldBe("unstable");
120+
config.Branches["dev(elop)?(ment)?$"].Tag.ShouldBe("unstable");
121121
config.Branches["release[/-]"].Tag.ShouldBe("beta");
122122
config.TagPrefix.ShouldBe(ConfigurationProvider.DefaultTagPrefix);
123123
config.NextVersion.ShouldBe(null);

src/GitVersionCore.Tests/GitVersionContextTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void UsesBranchSpecificConfigOverTopLevelDefaults()
3939
Branches =
4040
{
4141
{
42-
"develop", new BranchConfig
42+
"dev(elop)?(ment)?$", new BranchConfig
4343
{
4444
VersioningMode = VersioningMode.ContinuousDeployment,
4545
Tag = "alpha"
@@ -68,7 +68,7 @@ public void CanFindParentBranchForInheritingIncrementStrategy()
6868
{
6969
Branches =
7070
{
71-
{ "develop", new BranchConfig { Increment = IncrementStrategy.Major} },
71+
{ "dev(elop)?(ment)?$", new BranchConfig { Increment = IncrementStrategy.Major} },
7272
{ "feature[/-]", new BranchConfig { Increment = IncrementStrategy.Inherit} }
7373
}
7474
};

src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void CanChangeDevelopTagViaConfig()
5959
{
6060
Branches =
6161
{
62-
{"develop", new BranchConfig
62+
{"dev(elop)?(ment)?$", new BranchConfig
6363
{
6464
Tag = "alpha"
6565
}
@@ -75,6 +75,18 @@ public void CanChangeDevelopTagViaConfig()
7575
}
7676
}
7777

78+
[Test]
79+
public void WhenDeveloperBranchExistsDontTreatAsDevelop()
80+
{
81+
using (var fixture = new EmptyRepositoryFixture(new Config()))
82+
{
83+
fixture.Repository.MakeATaggedCommit("1.0.0");
84+
fixture.Repository.Checkout(fixture.Repository.CreateBranch("developer"));
85+
fixture.Repository.MakeACommit();
86+
fixture.AssertFullSemver("1.0.1-developer.1+1"); // this tag should be the branch name by default, not unstable
87+
}
88+
}
89+
7890
[Test]
7991
public void WhenDevelopBranchedFromMaster_MinorIsIncreased()
8092
{
@@ -113,7 +125,7 @@ public void CanHandleContinuousDelivery()
113125
{
114126
Branches =
115127
{
116-
{"develop", new BranchConfig
128+
{"dev(elop)?(ment)?$", new BranchConfig
117129
{
118130
VersioningMode = VersioningMode.ContinuousDelivery
119131
}

src/GitVersionCore/Configuration/ConfigurationProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static void ApplyDefaultsTo(Config config)
3939
defaultIncrementStrategy: IncrementStrategy.Inherit);
4040
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "hotfix[/-]"), defaultTag: "beta");
4141
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "support[/-]"), defaultTag: string.Empty, defaultPreventIncrement: true);
42-
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "develop"),
42+
ApplyBranchDefaults(config, GetOrCreateBranchDefaults(config, "dev(elop)?(ment)?$"),
4343
defaultTag: "unstable",
4444
defaultIncrementStrategy: IncrementStrategy.Minor,
4545
defaultVersioningMode: VersioningMode.ContinuousDeployment,

0 commit comments

Comments
 (0)