From 62377fcd276e6a357ef849f523df46a7fb4cc347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Ulsberg?= Date: Tue, 8 Mar 2022 21:40:36 +0100 Subject: [PATCH] Fall back to `master` if `main` is missing Fall back to `master` if `main` is missing. Fixes GH-2590. --- .../TrackReleaseBranchesVersionStrategy.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs index f8d123eba7..2f2217c4ba 100644 --- a/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/BaseVersionCalculators/TrackReleaseBranchesVersionStrategy.cs @@ -43,8 +43,13 @@ public override IEnumerable GetVersions() => private IEnumerable MainTagsVersions() { - var main = this.repositoryStore.FindBranch(Config.MainBranchKey); - return main != null ? this.taggedCommitVersionStrategy.GetTaggedVersions(main, null) : Array.Empty(); + var main = this.repositoryStore.FindBranch(Config.MainBranchKey) + // For compatibility reason try to find `master` if `main` cannot be found + ?? this.repositoryStore.FindBranch(Config.MasterBranchKey); + + return main != null + ? this.taggedCommitVersionStrategy.GetTaggedVersions(main, null) + : Array.Empty(); } private IEnumerable ReleaseBranchBaseVersions()