Skip to content

Commit 8db59be

Browse files
committed
Replace [^a-zA-Z0-9-] with - in BranchName variable. Otherwise the branch name variable can never be used in any SemVer spec since it can contain a / when using nested branches.
1 parent 5d6ed2a commit 8db59be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/GitVersionCore/OutputVariables/VariableProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GitVersion.VersioningModes;
66
using GitVersion.Configuration;
77
using GitVersion.Helpers;
8+
using GitVersion.Extensions;
89

910
namespace GitVersion.OutputVariables
1011
{
@@ -71,7 +72,7 @@ public VersionVariables GetVariablesFor(SemanticVersion semanticVersion, Effecti
7172
semverFormatValues.BuildMetaData,
7273
semverFormatValues.BuildMetaDataPadded,
7374
semverFormatValues.FullBuildMetaData,
74-
semverFormatValues.BranchName,
75+
semverFormatValues.BranchName?.RegexReplace("[^a-zA-Z0-9-]", "-"),
7576
semverFormatValues.Sha,
7677
semverFormatValues.ShortSha,
7778
semverFormatValues.MajorMinorPatch,

0 commit comments

Comments
 (0)