BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7a399b70
Commit
7a399b70
authored
Jan 09, 2017
by
Matthieu Tardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strip reference prefixes on branch creation
Signed-off-by:
Matthieu Tardy
<
matthieu.tardy@gmail.com
>
parent
8ab94120
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
26470-branch-names-with-reference-prefixes-results-in-buggy-branches.yml
...mes-with-reference-prefixes-results-in-buggy-branches.yml
+4
-0
git_ref_validator.rb
lib/gitlab/git_ref_validator.rb
+3
-0
git_ref_validator_spec.rb
spec/lib/git_ref_validator_spec.rb
+5
-0
No files found.
changelogs/unreleased/26470-branch-names-with-reference-prefixes-results-in-buggy-branches.yml
0 → 100644
View file @
7a399b70
---
title
:
Strip reference prefixes on branch creation
merge_request
:
8498
author
:
Matthieu Tardy
lib/gitlab/git_ref_validator.rb
View file @
7a399b70
...
...
@@ -5,6 +5,9 @@ module Gitlab
#
# Returns true for a valid reference name, false otherwise
def
validate
(
ref_name
)
return
false
if
ref_name
.
start_with?
(
'refs/heads/'
)
return
false
if
ref_name
.
start_with?
(
'refs/remotes/'
)
Gitlab
::
Utils
.
system_silent
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
check-ref-format refs/
#{
ref_name
}
)
)
end
...
...
spec/lib/git_ref_validator_spec.rb
View file @
7a399b70
...
...
@@ -5,6 +5,7 @@ describe Gitlab::GitRefValidator, lib: true do
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'implement_@all'
)).
to
be_truthy
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'my_new_feature'
)).
to
be_truthy
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'#1'
)).
to
be_truthy
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature/refs/heads/foo'
)).
to
be_truthy
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature/~new/'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature/^new/'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature/:new/'
)).
to
be_falsey
}
...
...
@@ -17,4 +18,8 @@ describe Gitlab::GitRefValidator, lib: true do
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature\new'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature//new'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'feature new'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'refs/heads/'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'refs/remotes/'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'refs/heads/feature'
)).
to
be_falsey
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'refs/remotes/origin'
)).
to
be_falsey
}
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment