-
Notifications
You must be signed in to change notification settings - Fork 652
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
[Bug] GitLab: Branch names cannot contain the word 'refs' #3103
Comments
Probably a duplicate of #2134 |
Thanks for digging out the problematic piece of code, @HHobeck. That is indeed fragile. I would assume we can replace |
I don't understand the intention of replacing public const string LocalBranchPrefix = "refs/heads/";
public const string RemoteBranchPrefix = "refs/remotes/";
public static readonly string[] PullRequestPrefixes = new[]
{
"refs/pull/",
"refs/pull-requests/",
"refs/remotes/pull/",
"refs/remotes/pull-requests/"
}; Thus I see following scenarios in
|
Yea, that seems quite wonky. If we could just use |
…-contains-the-word-refs Fix Bug: Branch names cannot contain the word 'refs' #3103
🎉 This issue has been resolved in version 6.0.0-beta.2 🎉 Your GitReleaseManager bot 📦🚀 |
In GitLab (currently on
GitLab Enterprise Edition 14.11.0-pre bf8e20209d4
) and using the latest GitVersion available on DockerHub (5.10.1
), if a branch has a name which contains the wordrefs
such as:my-refs-branch
my-test-refs
then detemining the version via gitversion results in the following logs:
The GitLab CI job is using the docker image of GitLab and is defined below:
First saw it on an older version of GitVersion as well (
5.6.11-debian.10-x64
).Expected Behavior
Regardless of the branch name, there should be no error generating the version.
Actual Behavior
Branch names with the word
refs
fail.Possible Fix
Checked the source and it seems like the word
refs
in the branch name interferes with the prefix checking in https://github.com/GitTools/GitVersion/blob/support/5.x/src/GitVersion.Core/Git/ReferenceName.cs when checked against these prefixes:Steps to Reproduce
.gitlab-ci.yml
file:refs
in it, such asmy-test-refs
.Determine version
step of the pipeline fails with the logs mentioned above.Context
Trying to add automated versioning to my pipeline.
Your Environment
Enterprise Edition 14.11.0-pre bf8e20209d4
5.10.1-debian.11-6.0-amd64
refs
in the branch name: https://gitlab.com/Daniel-Khodabakhsh/gitversion-bug/-/jobs/2386905935refs
in the branch name: https://gitlab.com/Daniel-Khodabakhsh/gitversion-bug/-/jobs/2386908295The text was updated successfully, but these errors were encountered: