You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.Tool
GitVersion version
6.0.1
Operating system
Windows
What are you seeing?
It took me a lot of experimentation to understand why I was getting the text "{BranchName}" in my GitVersion output ... and more confusingly: "--BranchName-" in my informational version numbers ...
It turns out that even though all the default configuration uses [/-] in the regex patterns, the actual value that the regex configuration is being matched against is the {EscapedBranchName} not the {BranchName} (so the / will never match).
What is expected?
I expected the regex to be matched against the branch name, with slashes in it (so I can use dashes WITHIN the path segments without breaking the regex matching). That is, we need to be able to use a branch name like feature/jaykul/new-terminal and have the {BranchName} come out as "new-terminal" not "terminal"
Additionally, I think the documentation needs to call out when variable output is being set by the regex patterns. This was not clear to me until I got the wrong output and started investigating -- the old behavior (5.x) allowed me to override the regex without needing to re-define the capture group.
Jaykul
changed the title
[ISSUE]: branch config regex is matched against [EscapedBranchName} not {BranchName} (which is confusing).
[ISSUE]: branch config regex is matched against {EscapedBranchName} not {BranchName} (which is confusing).
Aug 11, 2024
Jaykul
changed the title
[ISSUE]: branch config regex is matched against {EscapedBranchName} not {BranchName} (which is confusing).
[ISSUE]: branch regex is matched against {EscapedBranchName} not {BranchName}
Aug 11, 2024
Yes I agree this behavior is not intentionally. I think the related source code is located in the ConfigurationExtensions class (see Attachment[1]). May I ask you to change it and create a pull-request?
Prerequisites
GitVersion package
GitVersion.Tool
GitVersion version
6.0.1
Operating system
Windows
What are you seeing?
It took me a lot of experimentation to understand why I was getting the text "{BranchName}" in my GitVersion output ... and more confusingly: "--BranchName-" in my informational version numbers ...
It turns out that even though all the default configuration uses
[/-]
in the regex patterns, the actual value that theregex
configuration is being matched against is the {EscapedBranchName} not the {BranchName} (so the / will never match).What is expected?
I expected the regex to be matched against the branch name, with slashes in it (so I can use dashes WITHIN the path segments without breaking the regex matching). That is, we need to be able to use a branch name like
feature/jaykul/new-terminal
and have the {BranchName} come out as "new-terminal" not "terminal"Additionally, I think the documentation needs to call out when variable output is being set by the
regex
patterns. This was not clear to me until I got the wrong output and started investigating -- the old behavior (5.x) allowed me to override the regex without needing to re-define the capture group.Steps to Reproduce
Create branches config:
Create a branch named:
/feature/yourname/dash-separated-words
Run gitversion, and see {BranchName} everywhere.
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
No response
The text was updated successfully, but these errors were encountered: