Skip to content

Commit e8774a8

Browse files
authored
Merge pull request #2699 from mglochsen/feature/2679-release-branch-naming-with-major-only
(GH-2679) Support release branch naming with MAJOR SemVer number only
2 parents fe2e24b + 89f19bc commit e8774a8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/GitVersion.Core.Tests/VersionCalculation/SemanticVersionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public class SemanticVersionTests : TestBase
3434
[TestCase("v1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix)]
3535
[TestCase("V1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix)]
3636
[TestCase("version-1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", "version-")]
37+
[TestCase("1", 1, 0, 0, null, null, null, null, null, null, "1.0.0", null)]
38+
[TestCase("1.1", 1, 1, 0, null, null, null, null, null, null, "1.1.0", null)]
3739
public void ValidateVersionParsing(
3840
string versionString, int major, int minor, int patch, string tag, int? tagNumber, int? numberOfBuilds,
3941
string branchName, string sha, string otherMetaData, string fullFormattedVersionString, string tagPrefixRegex)

src/GitVersion.Core/VersionCalculation/SemanticVersioning/SemanticVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class SemanticVersion : IFormattable, IComparable<SemanticVersion>
88
private static SemanticVersion Empty = new SemanticVersion();
99

1010
private static readonly Regex ParseSemVer = new Regex(
11-
@"^(?<SemVer>(?<Major>\d+)(\.(?<Minor>\d+))(\.(?<Patch>\d+))?)(\.(?<FourthPart>\d+))?(-(?<Tag>[^\+]*))?(\+(?<BuildMetaData>.*))?$",
11+
@"^(?<SemVer>(?<Major>\d+)?(\.(?<Minor>\d+))?(\.(?<Patch>\d+))?)(\.(?<FourthPart>\d+))?(-(?<Tag>[^\+]*))?(\+(?<BuildMetaData>.*))?$",
1212
RegexOptions.Compiled);
1313

1414
public int Major;

0 commit comments

Comments
 (0)