Skip to content

#1355 Fix develop branch config in mainline mode #1371

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 11 additions & 0 deletions src/GitVersionCore.Tests/ConfigProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ public void OverwritesDefaultsWithProvidedConfig()
config.Branches["develop"].Tag.ShouldBe("dev");
}

[Test]
public void AllBranchesModeWhenUsingMainline()
{
var defaultConfig = ConfigurationProvider.Provide(repoPath, fileSystem);
const string text = @"mode: Mainline";
SetupConfigFileContent(text);
var config = ConfigurationProvider.Provide(repoPath, fileSystem);
var branches = config.Branches.Select(x => x.Value);
branches.All(branch => branch.VersioningMode == VersioningMode.Mainline).ShouldBe(true);
}

[Test]
public void CanRemoveTag()
{
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore/Configuration/ConfigurationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public static void ApplyDefaultsTo(Config config)
new List<string>(),
defaultTag: "alpha",
defaultIncrementStrategy: IncrementStrategy.Minor,
defaultVersioningMode: VersioningMode.ContinuousDeployment,
defaultVersioningMode: config.VersioningMode == VersioningMode.Mainline? VersioningMode.Mainline : VersioningMode.ContinuousDeployment,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't defaultVersioningMode always be set to config.VersioningMode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because documentation says that the develop branch is set to ContinuousDeployment mode by default. And all tests require develop branch in ContiniousDeployment mode. But in mainline mode we get wrong behaviour.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aha, that makes sense.

defaultTrackMergeTarget: true,
tracksReleaseBranches: true);
ApplyBranchDefaults(config,
Expand Down