Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: GitTools/GitVersion
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5.11.0
Choose a base ref
...
head repository: GitTools/GitVersion
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5.11.1
Choose a head ref
  • 1 commit
  • 10 files changed
  • 1 contributor

Commits on Nov 8, 2022

  1. Revert "Don't consider "tag-prefix" as optional if it's explicitly sp…

    …ecified"
    
    This reverts commit 1071e1c.
    AlexPykavy authored and arturcic committed Nov 8, 2022

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    darrachequesne Damien Arrachequesne
    Copy the full SHA
    82cbf2c View commit details
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
tag-prefix: '[vV]?'
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
Original file line number Diff line number Diff line change
@@ -461,7 +461,7 @@ public void ShouldUseDefaultTagPrefixWhenNotSetInConfigFile()
SetupConfigFileContent(text);
var config = this.configProvider.Provide(this.repoPath);

config.TagPrefix.ShouldBe(Config.DefaultTagPrefix);
config.TagPrefix.ShouldBe("[vV]");
}

[Test]
@@ -491,7 +491,7 @@ public void ShouldNotOverrideDefaultTagPrefixWhenNotSetInOverrideConfig()
SetupConfigFileContent(text);
var config = this.configProvider.Provide(this.repoPath, new Config { TagPrefix = null });

config.TagPrefix.ShouldBe(Config.DefaultTagPrefix);
config.TagPrefix.ShouldBe("[vV]");
}

[Test]
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ public TestEffectiveConfiguration(
string? assemblyFileVersioningFormat = null,
string? assemblyInformationalFormat = null,
VersioningMode versioningMode = VersioningMode.ContinuousDelivery,
string tagPrefix = "v?",
string tagPrefix = "v",
string tag = "",
string? nextVersion = null,
string branchPrefixToTrim = "",
2 changes: 1 addition & 1 deletion src/GitVersion.Core.Tests/Model/MergeMessageTests.cs
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ namespace GitVersion.Core.Tests;
[TestFixture]
public class MergeMessageTests : TestBase
{
private readonly Config config = new() { TagPrefix = Config.DefaultTagPrefix };
private readonly Config config = new() { TagPrefix = "[vV]" };

[Test]
public void NullMessageStringThrows() =>
Original file line number Diff line number Diff line change
@@ -65,7 +65,6 @@ public void ValidateVersionParsing(
[TestCase("someText")]
[TestCase("some-T-ext")]
[TestCase("v.1.2.3", "v")]
[TestCase("1.2.3", "v")]
public void ValidateInvalidVersionParsing(string versionString, string? tagPrefixRegex = null) =>
Assert.IsFalse(SemanticVersion.TryParse(versionString, tagPrefixRegex, out _), "TryParse Result");

Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public void ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo(strin
var workingDir = Path.GetTempPath();
var assemblyInfoFile = "VersionAssemblyInfo." + fileExtension;
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFile));
@@ -60,7 +60,7 @@ public void ShouldCreateAssemblyInfoFileAtPathWhenNotExistsAndEnsureAssemblyInfo
var workingDir = Path.GetTempPath();
var assemblyInfoFile = PathHelper.Combine("src", "Project", "Properties", $"VersionAssemblyInfo.{fileExtension}");
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFile));
@@ -81,7 +81,7 @@ public void ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInf
"AssemblyInfo." + fileExtension,
PathHelper.Combine("src", "Project", "Properties", "VersionAssemblyInfo." + fileExtension)
};
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFiles.ToArray()));
@@ -101,7 +101,7 @@ public void ShouldNotCreateAssemblyInfoFileWhenNotExistsAndNotEnsureAssemblyInfo
var workingDir = Path.GetTempPath();
var assemblyInfoFile = "VersionAssemblyInfo." + fileExtension;
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, false, assemblyInfoFile));
@@ -116,7 +116,7 @@ public void ShouldNotCreateAssemblyInfoFileForUnknownSourceCodeAndEnsureAssembly
var workingDir = Path.GetTempPath();
const string assemblyInfoFile = "VersionAssemblyInfo.js";
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFile));
@@ -130,7 +130,7 @@ public void ShouldStartSearchFromWorkingDirectory()
this.fileSystem = Substitute.For<IFileSystem>();
var workingDir = Path.GetTempPath();
var assemblyInfoFiles = Array.Empty<string>();
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v"), new TestEffectiveConfiguration(), false);

using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, false, assemblyInfoFiles.ToArray()));
Original file line number Diff line number Diff line change
@@ -154,7 +154,7 @@ public void CannotUpdateProjectFileWithoutAPropertyGroup(string xml)
[Description(NoMonoDescription)]
public void UpdateProjectXmlVersionElementWithStandardXmlInsertsElement(string xml)
{
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v"), new TestEffectiveConfiguration(), false);
var xmlRoot = XElement.Parse(xml);
variables.AssemblySemVer.ShouldNotBeNull();
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -183,7 +183,7 @@ public void UpdateProjectXmlVersionElementWithStandardXmlInsertsElement(string x
[Description(NoMonoDescription)]
public void UpdateProjectXmlVersionElementWithStandardXmlModifiesElement(string xml)
{
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v"), new TestEffectiveConfiguration(), false);
var xmlRoot = XElement.Parse(xml);
variables.AssemblySemVer.ShouldNotBeNull();
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -215,7 +215,7 @@ public void UpdateProjectXmlVersionElementWithStandardXmlModifiesElement(string
[Description(NoMonoDescription)]
public void UpdateProjectXmlVersionElementWithDuplicatePropertyGroupsModifiesLastElement(string xml)
{
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v"), new TestEffectiveConfiguration(), false);
var xmlRoot = XElement.Parse(xml);
variables.AssemblySemVer.ShouldNotBeNull();
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -248,7 +248,7 @@ public void UpdateProjectXmlVersionElementWithDuplicatePropertyGroupsModifiesLas
[Description(NoMonoDescription)]
public void UpdateProjectXmlVersionElementWithMultipleVersionElementsLastOneIsModified(string xml)
{
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v"), new TestEffectiveConfiguration(), false);
var xmlRoot = XElement.Parse(xml);
variables.AssemblySemVer.ShouldNotBeNull();
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
2 changes: 1 addition & 1 deletion src/GitVersion.Core/Model/Configuration/Config.cs
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ public override string ToString()
return stringBuilder.ToString();
}

public const string DefaultTagPrefix = "[vV]?";
public const string DefaultTagPrefix = "[vV]";
public const string ReleaseBranchRegex = "^releases?[/-]";
public const string FeatureBranchRegex = "^features?[/-]";
public const string PullRequestRegex = @"^(pull|pull\-requests|pr)[/-]";
2 changes: 1 addition & 1 deletion src/GitVersion.Core/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ const GitVersion.BuildAgents.SpaceAutomation.EnvironmentVariableName = "JB_SPACE
const GitVersion.BuildAgents.TeamCity.EnvironmentVariableName = "TEAMCITY_VERSION" -> string!
const GitVersion.BuildAgents.TravisCi.EnvironmentVariableName = "TRAVIS" -> string!
const GitVersion.Configuration.ConfigFileLocator.DefaultFileName = "GitVersion.yml" -> string!
const GitVersion.Model.Configuration.Config.DefaultTagPrefix = "[vV]?" -> string!
const GitVersion.Model.Configuration.Config.DefaultTagPrefix = "[vV]" -> string!
const GitVersion.Model.Configuration.Config.DevelopBranchKey = "develop" -> string!
const GitVersion.Model.Configuration.Config.DevelopBranchRegex = "^dev(elop)?(ment)?$" -> string!
const GitVersion.Model.Configuration.Config.FeatureBranchKey = "feature" -> string!
Original file line number Diff line number Diff line change
@@ -138,7 +138,7 @@ public static SemanticVersion Parse(string version, string? tagPrefixRegex)

public static bool TryParse(string version, string? tagPrefixRegex, [NotNullWhen(true)] out SemanticVersion? semanticVersion)
{
var match = Regex.Match(version, $"^({tagPrefixRegex})(?<version>.*)$");
var match = Regex.Match(version, $"^({tagPrefixRegex})?(?<version>.*)$");

if (!match.Success)
{