Skip to content

Commit 8b653e9

Browse files
committed
changed the default branch from master to main
1 parent 8937c25 commit 8b653e9

File tree

8 files changed

+31
-29
lines changed

8 files changed

+31
-29
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ from The Noun Project.
5353
[semver]: http://semver.org
5454
[gitter]: https://gitter.im/GitTools/GitVersion?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
5555
[gitter-badge]: https://badges.gitter.im/Join+Chat.svg
56-
[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/master
57-
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/master?svg=true
56+
[appveyor]: https://ci.appveyor.com/project/GitTools/gitversion/branch/main
57+
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/sxje0wht0cscmn7w/branch/main?svg=true
5858
[azure-pipeline]: https://dev.azure.com/GitTools/GitVersion/_build/latest?definitionId=1
5959
[azure-pipeline-badge]: https://dev.azure.com/GitTools/GitVersion/_apis/build/status/GitTools.GitVersion
6060
[github-actions]: https://github.com/GitTools/GitVersion/actions
6161
[github-actions-badge]: https://github.com/GitTools/GitVersion/workflows/Build/badge.svg
6262
[travis]: https://travis-ci.org/GitTools/GitVersion
63-
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=master
63+
[travis-badge]: https://travis-ci.org/GitTools/GitVersion.svg?branch=main
6464
[codecov]: https://codecov.io/gh/GitTools/GitVersion
65-
[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/master/graph/badge.svg
65+
[codecov-badge]: https://codecov.io/gh/GitTools/GitVersion/branch/main/graph/badge.svg
6666
[docs]: https://gitversion.net/docs/
6767
[gh-rel]: https://github.com/GitTools/GitVersion/releases/latest
6868
[gh-rel-badge]: https://img.shields.io/github/release/gittools/gitversion.svg?logo=github
@@ -82,11 +82,11 @@ from The Noun Project.
8282
[az-pipeline-task-badge]: https://img.shields.io/badge/marketplace-gittools.gittools-blue?logo=azure-pipelines
8383
[gh-actions]: https://github.com/marketplace/actions/gittools
8484
[gh-actions-badge]: https://img.shields.io/badge/marketplace-gittools-blue?logo=github
85-
[contribute]: https://github.com/GitTools/GitVersion/blob/master/CONTRIBUTING.md
85+
[contribute]: https://github.com/GitTools/GitVersion/blob/main/CONTRIBUTING.md
8686
[why]: https://gitversion.net/docs/why
8787
[usage]: https://gitversion.net/docs/usage/usage
8888
[how]: https://gitversion.net/docs/more-info/how-it-works
8989
[faq]: https://gitversion.net/docs/faq
9090
[who]: https://gitversion.net/docs/who
91-
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/master/docs/input/docs/img/README.png
92-
[banner]: https://github.com/GitTools/graphics/raw/master/GitVersion/banner-1280x640.png
91+
[gv-in-action]: https://raw.github.com/GitTools/GitVersion/main/docs/input/docs/img/README.png
92+
[banner]: https://github.com/GitTools/graphics/raw/main/GitVersion/banner-1280x640.png

src/GitTools.Testing/Fixtures/RepositoryFixtureBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void Checkout(string branch)
6666

6767
public static void Init(string path)
6868
{
69-
GitTestExtensions.ExecuteGitCmd($"init {path} -b master");
69+
GitTestExtensions.ExecuteGitCmd($"init {path} -b main");
7070
}
7171

7272
public void MakeATaggedCommit(string tag)

src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ branches:
2525
is-release-branch: false
2626
is-mainline: false
2727
pre-release-weight: 0
28-
master:
28+
main:
2929
mode: ContinuousDelivery
3030
tag: ''
3131
increment: Patch
@@ -48,7 +48,7 @@ branches:
4848
regex: ^releases?[/-]
4949
source-branches:
5050
- develop
51-
- master
51+
- main
5252
- support
5353
- release
5454
tracks-release-branches: false
@@ -64,7 +64,7 @@ branches:
6464
regex: ^features?[/-]
6565
source-branches:
6666
- develop
67-
- master
67+
- main
6868
- release
6969
- feature
7070
- support
@@ -83,7 +83,7 @@ branches:
8383
regex: ^(pull|pull\-requests|pr)[/-]
8484
source-branches:
8585
- develop
86-
- master
86+
- main
8787
- release
8888
- feature
8989
- support
@@ -101,7 +101,7 @@ branches:
101101
regex: ^hotfix(es)?[/-]
102102
source-branches:
103103
- develop
104-
- master
104+
- main
105105
- support
106106
tracks-release-branches: false
107107
is-release-branch: false
@@ -115,7 +115,7 @@ branches:
115115
track-merge-target: false
116116
regex: ^support[/-]
117117
source-branches:
118-
- master
118+
- main
119119
tracks-release-branches: false
120120
is-release-branch: false
121121
is-mainline: true

src/GitVersion.Core.Tests/Helpers/TestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class TestBase
1212
protected const string NoMonoDescription = "Won't run on Mono due to source information not being available for ShouldMatchApproved.";
1313
protected const string NoMono = "NoMono";
1414
protected const string NoNet48 = "NoNet48";
15-
public const string MainBranch = "master";
15+
public const string MainBranch = "main";
1616

1717
protected static IServiceProvider ConfigureServices(Action<IServiceCollection> overrideServices = null)
1818
{

src/GitVersion.Core.Tests/IntegrationTests/OtherScenarios.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ public void AllowHavingVariantsStartingWithMaster()
5757
}
5858

5959
[Test]
60-
public void AllowHavingMainInsteadOfMaster()
60+
public void AllowHavingMasterInsteadOfMain()
6161
{
6262
using var fixture = new EmptyRepositoryFixture();
6363
fixture.Repository.MakeACommit();
6464
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
65-
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("main"));
66-
fixture.Repository.Branches.Remove(fixture.Repository.Branches["master"]);
65+
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("master"));
66+
fixture.Repository.Branches.Remove(fixture.Repository.Branches["main"]);
6767

6868
fixture.AssertFullSemver("0.1.0+0");
6969
}

src/GitVersion.Core/Configuration/ConfigFileLocator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public Config ReadConfig(string workingDirectory)
4646
return new Config();
4747
}
4848

49-
public static void VerifyReadConfig(Config config)
49+
private static void VerifyReadConfig(Config config)
5050
{
5151
// Verify no branches are set to mainline mode
5252
if (config.Branches.Any(b => b.Value.VersioningMode == VersioningMode.Mainline))

src/GitVersion.Core/Configuration/ConfigurationBuilder.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class ConfigurationBuilder
1212
{
1313
private const int DefaultTagPreReleaseWeight = 60000;
1414

15-
private readonly List<Config> _overrides = new List<Config>();
15+
private readonly List<Config> _overrides = new();
1616

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

8888
var targetConfigBranches = targetConfig.Branches;
8989

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

97-
source.MergeTo(target);
98-
newBranches[key] = target;
99+
branchConfig.MergeTo(target);
100+
newBranches[branchName] = target;
99101
}
100102

101-
foreach (var (key, branchConfig) in targetConfigBranches)
103+
foreach (var (name, branchConfig) in targetConfigBranches)
102104
{
103-
if (!newBranches.ContainsKey(key))
105+
if (!newBranches.ContainsKey(name))
104106
{
105-
newBranches[key] = branchConfig;
107+
newBranches[name] = branchConfig;
106108
}
107109
}
108110

src/GitVersion.Core/Model/Configuration/Config.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public override string ToString()
115115
public const string SupportBranchRegex = "^support[/-]";
116116
public const string DevelopBranchRegex = "^dev(elop)?(ment)?$";
117117
public const string MainBranchRegex = "^master$|^main$";
118-
public const string MainBranchKey = "master";
118+
public const string MainBranchKey = "main";
119119
public const string MasterBranchKey = "master";
120120
public const string ReleaseBranchKey = "release";
121121
public const string FeatureBranchKey = "feature";

0 commit comments

Comments
 (0)