Skip to content

Commit

Permalink
changed the default branch from master to main
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Feb 1, 2021
1 parent 8937c25 commit 8b653e9
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 29 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ from The Noun Project.
[semver]: http://semver.org
[gitter]: https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
[gitter-badge]: https://badges.gitter.im/Join+Chat.svg
[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/master
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true
[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/main
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/main?svg=true
[azure-pipeline]: https://dev.azure.com/GitTools/GitVersion/_build/latest?definitionId=1
[azure-pipeline-badge]: https://dev.azure.com/GitTools/GitVersion/_apis/build/status/GitTools.GitVersion
[github-actions]: https://github.com/GitTools/GitVersion/actions
[github-actions-badge]: https://github.com/GitTools/GitVersion/workflows/Build/badge.svg
[travis]: https://travis-ci.org/GitTools/GitVersion
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=main
[codecov]: https://codecov.io/gh/GitTools/GitVersion
[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/master/graph/badge.svg
[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/main/graph/badge.svg
[docs]: https://gitversion.net/docs/
[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest
[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg?logo=github
Expand All @@ -82,11 +82,11 @@ from The Noun Project.
[az-pipeline-task-badge]: https://img.shields.io/badge/marketplace-gittools.gittools-blue?logo=azure-pipelines
[gh-actions]: https://github.com/marketplace/actions/gittools
[gh-actions-badge]: https://img.shields.io/badge/marketplace-gittools-blue?logo=github
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
[contribute]: https://github.com/GitTools/GitVersion/blob/main/CONTRIBUTING.md
[why]: https://gitversion.net/docs/why
[usage]: https://gitversion.net/docs/usage/usage
[how]: https://gitversion.net/docs/more-info/how-it-works
[faq]: https://gitversion.net/docs/faq
[who]: https://gitversion.net/docs/who
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/input/docs/img/README.png
[banner]: https://github.com/GitTools/graphics/raw/master/GitVersion/banner-1280x640.png
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/main/docs/input/docs/img/README.png
[banner]: https://github.com/GitTools/graphics/raw/main/GitVersion/banner-1280x640.png
2 changes: 1 addition & 1 deletion src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void Checkout(string branch)

public static void Init(string path)
{
GitTestExtensions.ExecuteGitCmd($"init {path} -b master");
GitTestExtensions.ExecuteGitCmd($"init {path} -b main");
}

public void MakeATaggedCommit(string tag)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ branches:
is-release-branch: false
is-mainline: false
pre-release-weight: 0
master:
main:
mode: ContinuousDelivery
tag: ''
increment: Patch
Expand All @@ -48,7 +48,7 @@ branches:
regex: ^releases?[/-]
source-branches:
- develop
- master
- main
- support
- release
tracks-release-branches: false
Expand All @@ -64,7 +64,7 @@ branches:
regex: ^features?[/-]
source-branches:
- develop
- master
- main
- release
- feature
- support
Expand All @@ -83,7 +83,7 @@ branches:
regex: ^(pull|pull\-requests|pr)[/-]
source-branches:
- develop
- master
- main
- release
- feature
- support
Expand All @@ -101,7 +101,7 @@ branches:
regex: ^hotfix(es)?[/-]
source-branches:
- develop
- master
- main
- support
tracks-release-branches: false
is-release-branch: false
Expand All @@ -115,7 +115,7 @@ branches:
track-merge-target: false
regex: ^support[/-]
source-branches:
- master
- main
tracks-release-branches: false
is-release-branch: false
is-mainline: true
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersion.Core.Tests/Helpers/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class TestBase
protected const string NoMonoDescription = "Won't run on Mono due to source information not being available for ShouldMatchApproved.";
protected const string NoMono = "NoMono";
protected const string NoNet48 = "NoNet48";
public const string MainBranch = "master";
public const string MainBranch = "main";

protected static IServiceProvider ConfigureServices(Action<IServiceCollection> overrideServices = null)
{
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ public void AllowHavingVariantsStartingWithMaster()
}

[Test]
public void AllowHavingMainInsteadOfMaster()
public void AllowHavingMasterInsteadOfMain()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("main"));
fixture.Repository.Branches.Remove(fixture.Repository.Branches["master"]);
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("master"));
fixture.Repository.Branches.Remove(fixture.Repository.Branches["main"]);

fixture.AssertFullSemver("0.1.0+0");
}
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersion.Core/Configuration/ConfigFileLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Config ReadConfig(string workingDirectory)
return new Config();
}

public static void VerifyReadConfig(Config config)
private static void VerifyReadConfig(Config config)
{
// Verify no branches are set to mainline mode
if (config.Branches.Any(b => b.Value.VersioningMode == VersioningMode.Mainline))
Expand Down
20 changes: 11 additions & 9 deletions src/GitVersion.Core/Configuration/ConfigurationBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ConfigurationBuilder
{
private const int DefaultTagPreReleaseWeight = 60000;

private readonly List<Config> _overrides = new List<Config>();
private readonly List<Config> _overrides = new();

public ConfigurationBuilder Add([NotNull] Config config)
{
Expand Down Expand Up @@ -87,22 +87,24 @@ private static void ApplyBranchOverrides(Config targetConfig, Config overrideCon

var targetConfigBranches = targetConfig.Branches;

foreach (var (key, source) in overrideConfig.Branches)
foreach (var (name, branchConfig) in overrideConfig.Branches)
{
if (!targetConfigBranches.TryGetValue(key, out var target))
// for compatibility reason we check if it's master, we rename it to main
var branchName = name == Config.MasterBranchKey ? Config.MainBranchKey : name;
if (!targetConfigBranches.TryGetValue(branchName, out var target))
{
target = BranchConfig.CreateDefaultBranchConfig(key);
target = BranchConfig.CreateDefaultBranchConfig(branchName);
}

source.MergeTo(target);
newBranches[key] = target;
branchConfig.MergeTo(target);
newBranches[branchName] = target;
}

foreach (var (key, branchConfig) in targetConfigBranches)
foreach (var (name, branchConfig) in targetConfigBranches)
{
if (!newBranches.ContainsKey(key))
if (!newBranches.ContainsKey(name))
{
newBranches[key] = branchConfig;
newBranches[name] = branchConfig;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/GitVersion.Core/Model/Configuration/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public override string ToString()
public const string SupportBranchRegex = "^support[/-]";
public const string DevelopBranchRegex = "^dev(elop)?(ment)?$";
public const string MainBranchRegex = "^master$|^main$";
public const string MainBranchKey = "master";
public const string MainBranchKey = "main";
public const string MasterBranchKey = "master";
public const string ReleaseBranchKey = "release";
public const string FeatureBranchKey = "feature";
Expand Down

0 comments on commit 8b653e9

Please sign in to comment.