Skip to content

Commit 7b3079c

Browse files
committed
changed constants "master" to MainBranch
1 parent 1066526 commit 7b3079c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+309
-308
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Issues are also welcome, [failing tests](#writing-tests) are even more welcome.
1414

1515
## Contribution Guidelines
1616

17-
- Try to use feature branches rather than developing on master.
17+
- Try to use feature branches rather than developing on main.
1818
- Please include tests covering the change.
1919
- The documentation is stored in the repository under the [`docs`](docs) folder.
2020
Have a look at the [documentation readme file](docs/readme.md) for guidance
@@ -29,7 +29,7 @@ See [how it works](http://gitversion.readthedocs.org/en/latest/more-info/how-it-
2929

3030
We have made it super easy to write tests in GitVersion. Most tests you are interested in are in `GitVersion.Core.Tests\IntegrationTests`.
3131

32-
There is a scenario class for each type of branch. For example MasterScenarios, FeatureBranchScenarios etc.
32+
There is a scenario class for each type of branch. For example MainScenarios, FeatureBranchScenarios etc.
3333

3434
### 1. Find Appropriate Scenario class
3535

@@ -87,7 +87,7 @@ We use Cake for our build and deployment process. The way the build / release pr
8787

8888
1) We build releasable artifacts on AppVeyor
8989
1) Login to AppVeyor
90-
1) Deploy the latest master build
90+
1) Deploy the latest main build
9191
![docs/input/docs/img/release-1-deploy.png](docs/input/docs/img/release-1-deploy.png)
9292
1) Choose GitVersion release, when you press deploy it will create a *non-released* GitHub release, this *will not* create a Git tag. This step is so we can validate the release and release notes before pushing the button.
9393
![docs/input/docs/img/release-2-deploy.png](docs/input/docs/img/release-2-deploy.png)

src/GitTools.Testing/Fixtures/BaseGitFlowRepositoryFixture.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@
55
namespace GitTools.Testing
66
{
77
/// <summary>
8-
/// Creates a repo with a develop branch off master which is a single commit ahead of master
8+
/// Creates a repo with a develop branch off main which is a single commit ahead of main
99
/// </summary>
1010
public class BaseGitFlowRepositoryFixture : EmptyRepositoryFixture
1111
{
1212
/// <summary>
13-
/// Creates a repo with a develop branch off master which is a single commit ahead of master
13+
/// Creates a repo with a develop branch off main which is a single commit ahead of main
1414
///
15-
/// Master will be tagged with the initial version before branching develop
15+
/// Main will be tagged with the initial version before branching develop
1616
/// </summary>
1717
public BaseGitFlowRepositoryFixture(string initialVersion) :
1818
this(r => r.MakeATaggedCommit(initialVersion))
1919
{
2020
}
2121

2222
/// <summary>
23-
/// Creates a repo with a develop branch off master which is a single commit ahead of master
23+
/// Creates a repo with a develop branch off main which is a single commit ahead of main
2424
///
2525
/// The initial setup actions will be performed before branching develop
2626
/// </summary>
27-
public BaseGitFlowRepositoryFixture(Action<IRepository> initialMasterAction)
27+
public BaseGitFlowRepositoryFixture(Action<IRepository> initialMainAction)
2828
{
29-
SetupRepo(initialMasterAction);
29+
SetupRepo(initialMainAction);
3030
}
3131

32-
void SetupRepo(Action<IRepository> initialMasterAction)
32+
void SetupRepo(Action<IRepository> initialMainAction)
3333
{
3434
var randomFile = Path.Combine(Repository.Info.WorkingDirectory, Guid.NewGuid().ToString());
3535
File.WriteAllText(randomFile, string.Empty);
3636
Commands.Stage(Repository, randomFile);
3737

38-
initialMasterAction(Repository);
38+
initialMainAction(Repository);
3939

4040
Commands.Checkout(Repository, Repository.CreateBranch("develop"));
4141
Repository.MakeACommit();

src/GitVersion.App.Tests/PullRequestInBuildAgentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ private static async Task VerifyPullRequestVersionIsCalculatedProperly(string pu
151151
Commands.Checkout(remoteRepository, remoteRepository.Head.Tip.Sha);
152152
//Emulate merge commit
153153
var mergeCommitSha = remoteRepository.MakeACommit().Sha;
154-
Commands.Checkout(remoteRepository, "master"); // HEAD cannot be pointing at the merge commit
154+
Commands.Checkout(remoteRepository, TestBase.MainBranch); // HEAD cannot be pointing at the merge commit
155155
remoteRepository.Refs.Add(pullRequestRef, new ObjectId(mergeCommitSha));
156156

157157
// Checkout PR commit

src/GitVersion.Core.Tests/BuildAgents/CodeBuildTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public void CorrectlyIdentifiesCodeBuildPresenceFromSourceVersion()
3939
[Test]
4040
public void PicksUpBranchNameFromEnvironmentFromSourceVersion()
4141
{
42-
environment.SetEnvironmentVariable(CodeBuild.SourceVersionEnvironmentVariableName, "refs/heads/master");
43-
buildServer.GetCurrentBranch(false).ShouldBe("refs/heads/master");
42+
environment.SetEnvironmentVariable(CodeBuild.SourceVersionEnvironmentVariableName, $"refs/heads/{MainBranch}");
43+
buildServer.GetCurrentBranch(false).ShouldBe($"refs/heads/{MainBranch}");
4444
}
4545

4646
[Test]
@@ -53,8 +53,8 @@ public void CorrectlyIdentifiesCodeBuildPresenceFromWebHook()
5353
[Test]
5454
public void PicksUpBranchNameFromEnvironmentFromWebHook()
5555
{
56-
environment.SetEnvironmentVariable(CodeBuild.WebHookEnvironmentVariableName, "refs/heads/master");
57-
buildServer.GetCurrentBranch(false).ShouldBe("refs/heads/master");
56+
environment.SetEnvironmentVariable(CodeBuild.WebHookEnvironmentVariableName, $"refs/heads/{MainBranch}");
57+
buildServer.GetCurrentBranch(false).ShouldBe($"refs/heads/{MainBranch}");
5858
}
5959

6060
[Test]

src/GitVersion.Core.Tests/BuildAgents/GitHubActionsTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public void CanApplyToCurrentContextShouldBeFalseWhenEnvironmentVariableIsNotSet
7070
public void GetCurrentBranchShouldHandleBranches()
7171
{
7272
// Arrange
73-
environment.SetEnvironmentVariable("GITHUB_REF", "refs/heads/master");
73+
environment.SetEnvironmentVariable("GITHUB_REF", $"refs/heads/{MainBranch}");
7474

7575
// Act
7676
var result = buildServer.GetCurrentBranch(false);
7777

7878
// Assert
79-
result.ShouldBe("refs/heads/master");
79+
result.ShouldBe($"refs/heads/{MainBranch}");
8080
}
8181

8282
[Test]

src/GitVersion.Core.Tests/BuildAgents/JenkinsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ public void JenkinsTakesLocalBranchNameNotRemoteName()
6565
var localBranchOrig = environment.GetEnvironmentVariable(localBranch);
6666

6767
// Set GIT_BRANCH for testing
68-
environment.SetEnvironmentVariable(branch, "origin/master");
68+
environment.SetEnvironmentVariable(branch, $"origin/{MainBranch}");
6969

7070
// Test Jenkins that GetCurrentBranch falls back to GIT_BRANCH if GIT_LOCAL_BRANCH undefined
71-
buildServer.GetCurrentBranch(true).ShouldBe("origin/master");
71+
buildServer.GetCurrentBranch(true).ShouldBe($"origin/{MainBranch}");
7272

7373
// Set GIT_LOCAL_BRANCH
74-
environment.SetEnvironmentVariable(localBranch, "master");
74+
environment.SetEnvironmentVariable(localBranch, MainBranch);
7575

7676
// Test Jenkins GetCurrentBranch method now returns GIT_LOCAL_BRANCH
77-
buildServer.GetCurrentBranch(true).ShouldBe("master");
77+
buildServer.GetCurrentBranch(true).ShouldBe(MainBranch);
7878

7979
// Restore environment variables
8080
environment.SetEnvironmentVariable(branch, branchOrig);
@@ -90,13 +90,13 @@ public void JenkinsTakesBranchNameInPipelineAsCode()
9090
var pipelineBranchOrig = environment.GetEnvironmentVariable(pipelineBranch);
9191

9292
// Set BRANCH_NAME in pipeline mode
93-
environment.SetEnvironmentVariable(pipelineBranch, "master");
93+
environment.SetEnvironmentVariable(pipelineBranch, MainBranch);
9494
// When Jenkins uses a Pipeline, GIT_BRANCH and GIT_LOCAL_BRANCH are not set:
9595
environment.SetEnvironmentVariable(branch, null);
9696
environment.SetEnvironmentVariable(localBranch, null);
9797

9898
// Test Jenkins GetCurrentBranch method now returns BRANCH_NAME
99-
buildServer.GetCurrentBranch(true).ShouldBe("master");
99+
buildServer.GetCurrentBranch(true).ShouldBe(MainBranch);
100100

101101
// Restore environment variables
102102
environment.SetEnvironmentVariable(branch, branchOrig);

src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void SourceBranchesValidationShouldFailWhenMatchingBranchConfigurationIsM
131131
}
132132

133133
[Test(Description = "Well-known branches may not be present in the configuration file. This test confirms the validation check succeeds when the source-branches configuration contain these well-known branches.")]
134-
[TestCase(Config.MasterBranchKey)]
134+
[TestCase(Config.MainBranchKey)]
135135
[TestCase(Config.DevelopBranchKey)]
136136
public void SourceBranchesValidationShouldSucceedForWellKnownBranches(string wellKnownBranchKey)
137137
{
@@ -380,7 +380,7 @@ public void ShouldUseDefaultSourceBranchesWhenNotSpecifiedForFeature()
380380
var config = configProvider.Provide(repoPath);
381381

382382
config.Branches["feature"].SourceBranches.ShouldBe(
383-
new List<string> { "develop", "master", "release", "feature", "support", "hotfix" });
383+
new List<string> { "develop", MainBranch, "release", "feature", "support", "hotfix" });
384384
}
385385

386386
[Test]

src/GitVersion.Core.Tests/Core/DynamicRepositoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public void Cleanup()
5252

5353
// Note: use same name twice to see if changing commits works on same (cached) repository
5454
[NonParallelizable]
55-
[TestCase("GV_master", "https://github.com/GitTools/GitVersion", "master", "4783d325521463cd6cf1b61074352da84451f25d", "4.0.0+1086")]
56-
[TestCase("GV_master", "https://github.com/GitTools/GitVersion", "master", "3bdcd899530b4e9b37d13639f317da04a749e728", "4.0.0+1092")]
55+
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "4783d325521463cd6cf1b61074352da84451f25d", "4.0.0+1086")]
56+
[TestCase("GV_main", "https://github.com/GitTools/GitVersion", MainBranch, "3bdcd899530b4e9b37d13639f317da04a749e728", "4.0.0+1092")]
5757
public void FindsVersionInDynamicRepo(string name, string url, string targetBranch, string commitId, string expectedFullSemVer)
5858
{
5959
var root = Path.Combine(workDirectory, name);

src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void CacheKeySameAfterReNormalizing()
3131
{
3232
using var fixture = new EmptyRepositoryFixture();
3333
var targetUrl = "https://github.com/GitTools/GitVersion.git";
34-
var targetBranch = "refs/head/master";
34+
var targetBranch = $"refs/head/{MainBranch}";
3535

3636
var gitVersionOptions = new GitVersionOptions
3737
{
@@ -93,7 +93,7 @@ public void CacheKeyForWorktree()
9393

9494
var gitVersionOptions = new GitVersionOptions
9595
{
96-
RepositoryInfo = { TargetUrl = targetUrl, TargetBranch = "master" },
96+
RepositoryInfo = { TargetUrl = targetUrl, TargetBranch = MainBranch },
9797
WorkingDirectory = worktreePath
9898
};
9999

src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public void FindsCorrectMergeBaseForForwardMerge()
3131
// | *4441531 54 minutes ago
3232
// | *89840df 56 minutes ago
3333
// |/
34-
//*91bf945 58 minutes ago(master)
34+
//*91bf945 58 minutes ago(main)
3535
using var fixture = new EmptyRepositoryFixture();
3636
fixture.MakeACommit("initial");
3737
fixture.BranchTo("develop");
@@ -85,7 +85,7 @@ public void FindsCorrectMergeBaseForForwardMergeMovesOn()
8585
// | *4441531 54 minutes ago
8686
// | *89840df 56 minutes ago
8787
// |/
88-
//*91bf945 58 minutes ago(master)
88+
//*91bf945 58 minutes ago(main)
8989
using var fixture = new EmptyRepositoryFixture();
9090
fixture.MakeACommit("initial");
9191
fixture.BranchTo("develop");
@@ -145,7 +145,7 @@ public void FindsCorrectMergeBaseForMultipleForwardMerges()
145145
//| *8113776 54 minutes ago
146146
//| *3c0235e 56 minutes ago
147147
//|/
148-
//*f6f1283 58 minutes ago(master)
148+
//*f6f1283 58 minutes ago(main)
149149

150150
using var fixture = new EmptyRepositoryFixture();
151151
fixture.MakeACommit("initial");

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public void Build()
8585
private static IGitRepository CreateRepository()
8686
{
8787
var mockCommit = GitToolsTestingExtensions.CreateMockCommit();
88-
var mockBranch = GitToolsTestingExtensions.CreateMockBranch("master", mockCommit);
88+
var mockBranch = GitToolsTestingExtensions.CreateMockBranch(TestBase.MainBranch, mockCommit);
8989
var branches = Substitute.For<IBranchCollection>();
9090
branches.GetEnumerator().Returns(_ => ((IEnumerable<IBranch>)new[] { mockBranch }).GetEnumerator());
9191

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +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";
1516

1617
protected static IServiceProvider ConfigureServices(Action<IServiceCollection> overrideServices = null)
1718
{

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void WhenDevelopHasMultipleCommitsSpecifyNonExistingCommitId()
4444
}
4545

4646
[Test]
47-
public void WhenDevelopBranchedFromTaggedCommitOnMasterVersionDoesNotChange()
47+
public void WhenDevelopBranchedFromTaggedCommitOnMainVersionDoesNotChange()
4848
{
4949
using var fixture = new EmptyRepositoryFixture();
5050
fixture.Repository.MakeATaggedCommit("1.0.0");
@@ -87,7 +87,7 @@ public void WhenDeveloperBranchExistsDontTreatAsDevelop()
8787
}
8888

8989
[Test]
90-
public void WhenDevelopBranchedFromMasterMinorIsIncreased()
90+
public void WhenDevelopBranchedFromMainMinorIsIncreased()
9191
{
9292
using var fixture = new EmptyRepositoryFixture();
9393
fixture.Repository.MakeATaggedCommit("1.0.0");
@@ -97,15 +97,15 @@ public void WhenDevelopBranchedFromMasterMinorIsIncreased()
9797
}
9898

9999
[Test]
100-
public void MergingReleaseBranchBackIntoDevelopWithMergingToMasterDoesBumpDevelopVersion()
100+
public void MergingReleaseBranchBackIntoDevelopWithMergingToMainDoesBumpDevelopVersion()
101101
{
102102
using var fixture = new EmptyRepositoryFixture();
103103
fixture.Repository.MakeATaggedCommit("1.0.0");
104104
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("develop"));
105105
fixture.Repository.MakeACommit();
106106
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("release-2.0.0"));
107107
fixture.Repository.MakeACommit();
108-
Commands.Checkout(fixture.Repository, "master");
108+
Commands.Checkout(fixture.Repository, MainBranch);
109109
fixture.Repository.MergeNoFF("release-2.0.0", Generate.SignatureNow());
110110

111111
Commands.Checkout(fixture.Repository, "develop");
@@ -128,7 +128,7 @@ public void CanHandleContinuousDelivery()
128128
}
129129

130130
[Test]
131-
public void WhenDevelopBranchedFromMasterDetachedHeadMinorIsIncreased()
131+
public void WhenDevelopBranchedFromMainDetachedHeadMinorIsIncreased()
132132
{
133133
using var fixture = new EmptyRepositoryFixture();
134134
fixture.Repository.MakeATaggedCommit("1.0.0");
@@ -184,7 +184,7 @@ public void WhenMultipleDevelopBranchesExistAndCurrentBranchHasIncrementInheritP
184184
public void TagOnHotfixShouldNotAffectDevelop()
185185
{
186186
using var fixture = new BaseGitFlowRepositoryFixture("1.2.0");
187-
Commands.Checkout(fixture.Repository, "master");
187+
Commands.Checkout(fixture.Repository, MainBranch);
188188
var hotfix = fixture.Repository.CreateBranch("hotfix-1.2.1");
189189
Commands.Checkout(fixture.Repository, hotfix);
190190
fixture.Repository.MakeACommit();
@@ -223,7 +223,7 @@ public void CommitsSinceVersionSourceShouldNotGoDownUponGitFlowReleaseFinish()
223223
fixture.MakeACommit("commit in release/1.2.0 - 2");
224224
fixture.MakeACommit("commit in release/1.2.0 - 3");
225225
fixture.AssertFullSemver("1.2.0-beta.1+3");
226-
fixture.Checkout("master");
226+
fixture.Checkout(MainBranch);
227227
fixture.MergeNoFF("release/1.2.0");
228228
fixture.ApplyTag("1.2.0");
229229
fixture.Checkout("develop");
@@ -246,7 +246,7 @@ public void CommitsSinceVersionSourceShouldNotGoDownUponMergingFeatureOnlyToDeve
246246
};
247247

248248
using var fixture = new EmptyRepositoryFixture();
249-
fixture.MakeACommit("commit in master - 1");
249+
fixture.MakeACommit($"commit in {MainBranch} - 1");
250250
fixture.ApplyTag("1.1.0");
251251
fixture.BranchTo("develop");
252252
fixture.MakeACommit("commit in develop - 1");
@@ -309,7 +309,7 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi
309309
fixture.Repository.MakeCommits(3);
310310

311311
// Simulate a GitFlow release finish.
312-
fixture.Checkout("master");
312+
fixture.Checkout(MainBranch);
313313
fixture.MergeNoFF(ReleaseBranch);
314314
fixture.ApplyTag("v1.1.0");
315315
fixture.Checkout("develop");
@@ -366,7 +366,7 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi
366366
fixture.AssertFullSemver("1.1.0-beta.3", config);
367367

368368
// Simulate a GitFlow release finish.
369-
fixture.Checkout("master");
369+
fixture.Checkout(MainBranch);
370370
fixture.MergeNoFF(ReleaseBranch);
371371
fixture.ApplyTag("v1.1.0");
372372
fixture.Checkout("develop");
@@ -379,12 +379,12 @@ public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseForDevelopCommi
379379

380380
// Create hotfix for defects found in release/1.1.0
381381
const string HotfixBranch = "hotfix/1.1.1";
382-
fixture.Checkout("master");
382+
fixture.Checkout(MainBranch);
383383
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch(HotfixBranch));
384384
fixture.Repository.MakeCommits(3);
385385

386386
// Hotfix finish
387-
fixture.Checkout("master");
387+
fixture.Checkout(MainBranch);
388388
fixture.Repository.MergeNoFF(HotfixBranch);
389389
fixture.Repository.ApplyTag("v1.1.1");
390390

0 commit comments

Comments
 (0)