Skip to content

Commit d62885c

Browse files
authored
Merge branch 'main' into addTroubleshootingInformationForNormalisationBug
2 parents 47bcb88 + d056ec8 commit d62885c

File tree

10 files changed

+21
-20
lines changed

10 files changed

+21
-20
lines changed

docs/input/docs/learn/branching-strategies/index.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RedirectFrom:
1717
<pre><code class="language-shell">e137e9 -> 1.0.0+0
1818
a5f6c5 -> 1.0.1+1
1919
adb29a -> 1.0.1-feature-foo.1+1 (PR #5 Version: `1.0.1-PullRequest.5+2`)
20-
7c2438 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
20+
7c2430 -> 1.0.1-feature-foo.1+2 (PR #5 Version: `1.0.1-PullRequest.5+3`)
2121
5f413b -> 1.0.1+4
2222
d6155b -> 2.0.0-rc.1+0 (Before and after tag)
2323
d53ab6 -> 2.0.0-rc.2+1 (Pre-release number was bumped because of the tag on previous commit)

src/Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<PackageVersion Include="LibGit2Sharp.NativeBinaries" Version="2.0.315-alpha.0.9"/>
99
<PackageVersion Include="JetBrains.Annotations" Version="2022.3.1"/>
1010

11-
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.3.2"/>
11+
<PackageVersion Include="Microsoft.Build.Utilities.Core" Version="17.4.0"/>
1212
<PackageVersion Include="Microsoft.Build" Version="17.3.2"/>
1313
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="3.3.3"/>
1414
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0"/>
@@ -26,7 +26,7 @@
2626
<PackageVersion Include="MSBuild.ProjectCreation" Version="8.3.0"/>
2727
<PackageVersion Include="NSubstitute" Version="4.4.0"/>
2828
<PackageVersion Include="NUnit" Version="3.13.3"/>
29-
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.0"/>
29+
<PackageVersion Include="NUnit3TestAdapter" Version="4.3.1"/>
3030
<PackageVersion Include="JunitXml.TestLogger" Version="3.0.114"/>
3131
<PackageVersion Include="Shouldly" Version="4.1.0"/>
3232

src/GitVersion.Core.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
assembly-versioning-scheme: MajorMinorPatch
22
assembly-file-versioning-scheme: MajorMinorPatch
33
mode: ContinuousDelivery
4-
tag-prefix: '[vV]?'
4+
tag-prefix: '[vV]'
55
continuous-delivery-fallback-tag: ci
66
major-version-bump-message: '\+semver:\s?(breaking|major)'
77
minor-version-bump-message: '\+semver:\s?(feature|minor)'

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public TestEffectiveConfiguration(
1313
string? assemblyFileVersioningFormat = null,
1414
string? assemblyInformationalFormat = null,
1515
VersioningMode versioningMode = VersioningMode.ContinuousDelivery,
16-
string tagPrefix = "v?",
16+
string tagPrefix = GitVersionConfiguration.DefaultTagPrefix,
1717
string tag = "",
1818
string? nextVersion = null,
1919
string branchPrefixToTrim = "",

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public void ValidateVersionParsing(
6565

6666
[TestCase("someText")]
6767
[TestCase("some-T-ext")]
68-
[TestCase("v.1.2.3", "v")]
69-
[TestCase("1.2.3", "v")]
68+
[TestCase("v.1.2.3", GitVersionConfiguration.DefaultTagPrefix)]
7069
public void ValidateInvalidVersionParsing(string versionString, string? tagPrefixRegex = null) =>
7170
Assert.IsFalse(SemanticVersion.TryParse(versionString, tagPrefixRegex, out _), "TryParse Result");
7271

src/GitVersion.Core.Tests/VersionConverters/AssemblyInfoFileUpdaterTests.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using GitVersion.Configuration;
12
using GitVersion.Core.Tests.Helpers;
23
using GitVersion.Extensions;
34
using GitVersion.Helpers;
@@ -40,7 +41,7 @@ public void ShouldCreateAssemblyInfoFileWhenNotExistsAndEnsureAssemblyInfo(strin
4041
var workingDir = Path.GetTempPath();
4142
var assemblyInfoFile = "VersionAssemblyInfo." + fileExtension;
4243
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
43-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
44+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
4445

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

6162
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
6263
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFile));
@@ -75,7 +76,7 @@ public void ShouldCreateAssemblyInfoFilesAtPathWhenNotExistsAndEnsureAssemblyInf
7576
"AssemblyInfo." + fileExtension,
7677
PathHelper.Combine("src", "Project", "Properties", "VersionAssemblyInfo." + fileExtension)
7778
};
78-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
79+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
7980

8081
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
8182
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFiles.ToArray()));
@@ -95,7 +96,7 @@ public void ShouldNotCreateAssemblyInfoFileWhenNotExistsAndNotEnsureAssemblyInfo
9596
var workingDir = Path.GetTempPath();
9697
var assemblyInfoFile = "VersionAssemblyInfo." + fileExtension;
9798
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
98-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
99+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
99100

100101
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
101102
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, false, assemblyInfoFile));
@@ -110,7 +111,7 @@ public void ShouldNotCreateAssemblyInfoFileForUnknownSourceCodeAndEnsureAssembly
110111
var workingDir = Path.GetTempPath();
111112
const string assemblyInfoFile = "VersionAssemblyInfo.js";
112113
var fullPath = PathHelper.Combine(workingDir, assemblyInfoFile);
113-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
114+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
114115

115116
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
116117
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, true, assemblyInfoFile));
@@ -124,7 +125,7 @@ public void ShouldStartSearchFromWorkingDirectory()
124125
this.fileSystem = Substitute.For<IFileSystem>();
125126
var workingDir = Path.GetTempPath();
126127
var assemblyInfoFiles = Array.Empty<string>();
127-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", "v?"), new TestEffectiveConfiguration(), false);
128+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("1.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
128129

129130
using var assemblyInfoFileUpdater = new AssemblyInfoFileUpdater(this.log, this.fileSystem);
130131
assemblyInfoFileUpdater.Execute(variables, new AssemblyInfoContext(workingDir, false, assemblyInfoFiles.ToArray()));

src/GitVersion.Core.Tests/VersionConverters/ProjectFileUpdaterTests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Xml.Linq;
2+
using GitVersion.Configuration;
23
using GitVersion.Core.Tests.Helpers;
34
using GitVersion.Extensions;
45
using GitVersion.Helpers;
@@ -142,7 +143,7 @@ public void CannotUpdateProjectFileWithoutAPropertyGroup(string xml)
142143
)]
143144
public void UpdateProjectXmlVersionElementWithStandardXmlInsertsElement(string xml)
144145
{
145-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
146+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
146147
var xmlRoot = XElement.Parse(xml);
147148
variables.AssemblySemVer.ShouldNotBeNull();
148149
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -169,7 +170,7 @@ public void UpdateProjectXmlVersionElementWithStandardXmlInsertsElement(string x
169170
)]
170171
public void UpdateProjectXmlVersionElementWithStandardXmlModifiesElement(string xml)
171172
{
172-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
173+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
173174
var xmlRoot = XElement.Parse(xml);
174175
variables.AssemblySemVer.ShouldNotBeNull();
175176
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -199,7 +200,7 @@ public void UpdateProjectXmlVersionElementWithStandardXmlModifiesElement(string
199200
)]
200201
public void UpdateProjectXmlVersionElementWithDuplicatePropertyGroupsModifiesLastElement(string xml)
201202
{
202-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
203+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
203204
var xmlRoot = XElement.Parse(xml);
204205
variables.AssemblySemVer.ShouldNotBeNull();
205206
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);
@@ -230,7 +231,7 @@ public void UpdateProjectXmlVersionElementWithDuplicatePropertyGroupsModifiesLas
230231
)]
231232
public void UpdateProjectXmlVersionElementWithMultipleVersionElementsLastOneIsModified(string xml)
232233
{
233-
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", "v?"), new TestEffectiveConfiguration(), false);
234+
var variables = this.variableProvider.GetVariablesFor(SemanticVersion.Parse("2.0.0", GitVersionConfiguration.DefaultTagPrefix), new TestEffectiveConfiguration(), false);
234235
var xmlRoot = XElement.Parse(xml);
235236
variables.AssemblySemVer.ShouldNotBeNull();
236237
ProjectFileUpdater.UpdateProjectVersionElement(xmlRoot, ProjectFileUpdater.AssemblyVersionElement, variables.AssemblySemVer);

src/GitVersion.Core/Configuration/GitVersionConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public override string ToString()
9797
return stringBuilder.ToString();
9898
}
9999

100-
public const string DefaultTagPrefix = "[vV]?";
100+
public const string DefaultTagPrefix = "[vV]";
101101
public const string ReleaseBranchRegex = "^releases?[/-]";
102102
public const string FeatureBranchRegex = "^features?[/-]";
103103
public const string PullRequestRegex = @"^(pull|pull\-requests|pr)[/-]";

src/GitVersion.Core/PublicAPI.Shipped.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const GitVersion.BuildAgents.SpaceAutomation.EnvironmentVariableName = "JB_SPACE
2828
const GitVersion.BuildAgents.TeamCity.EnvironmentVariableName = "TEAMCITY_VERSION" -> string!
2929
const GitVersion.BuildAgents.TravisCi.EnvironmentVariableName = "TRAVIS" -> string!
3030
const GitVersion.Configuration.ConfigurationFileLocator.DefaultFileName = "GitVersion.yml" -> string!
31-
const GitVersion.Configuration.GitVersionConfiguration.DefaultTagPrefix = "[vV]?" -> string!
31+
const GitVersion.Configuration.GitVersionConfiguration.DefaultTagPrefix = "[vV]" -> string!
3232
const GitVersion.Configuration.GitVersionConfiguration.DevelopBranchKey = "develop" -> string!
3333
const GitVersion.Configuration.GitVersionConfiguration.DevelopBranchRegex = "^dev(elop)?(ment)?$" -> string!
3434
const GitVersion.Configuration.GitVersionConfiguration.FeatureBranchKey = "feature" -> string!

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public static SemanticVersion Parse(string version, string? tagPrefixRegex, Sema
143143

144144
public static bool TryParse(string version, string? tagPrefixRegex, [NotNullWhen(true)] out SemanticVersion? semanticVersion, SemanticVersionFormat format = SemanticVersionFormat.Strict)
145145
{
146-
var match = Regex.Match(version, $"^({tagPrefixRegex})(?<version>.*)$");
146+
var match = Regex.Match(version, $"^({tagPrefixRegex})?(?<version>.*)$");
147147

148148
if (!match.Success)
149149
{

0 commit comments

Comments
 (0)