Skip to content

(GH-2679) Support release branch naming with MAJOR SemVer number only #2699

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class SemanticVersionTests : TestBase
[TestCase("v1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix)]
[TestCase("V1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", Config.DefaultTagPrefix)]
[TestCase("version-1.2.3", 1, 2, 3, null, null, null, null, null, null, "1.2.3", "version-")]
[TestCase("1", 1, 0, 0, null, null, null, null, null, null, "1.0.0", null)]
[TestCase("1.1", 1, 1, 0, null, null, null, null, null, null, "1.1.0", null)]
public void ValidateVersionParsing(
string versionString, int major, int minor, int patch, string tag, int? tagNumber, int? numberOfBuilds,
string branchName, string sha, string otherMetaData, string fullFormattedVersionString, string tagPrefixRegex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class SemanticVersion : IFormattable, IComparable<SemanticVersion>
private static SemanticVersion Empty = new SemanticVersion();

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

public int Major;
Expand Down