Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
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
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
0 deletions
+12
-0
changelogs/unreleased/26470-branch-names-with-reference-prefixes-results-in-buggy-branches.yml
...mes-with-reference-prefixes-results-in-buggy-branches.yml
+4
-0
lib/gitlab/git_ref_validator.rb
lib/gitlab/git_ref_validator.rb
+3
-0
spec/lib/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
...
@@ -5,6 +5,9 @@ module Gitlab
#
#
# Returns true for a valid reference name, false otherwise
# Returns true for a valid reference name, false otherwise
def
validate
(
ref_name
)
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
(
Gitlab
::
Utils
.
system_silent
(
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
check-ref-format refs/
#{
ref_name
}
)
)
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
check-ref-format refs/
#{
ref_name
}
)
)
end
end
...
...
spec/lib/git_ref_validator_spec.rb
View file @
7a399b70
...
@@ -5,6 +5,7 @@ describe Gitlab::GitRefValidator, lib: true do
...
@@ -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
(
'implement_@all'
)).
to
be_truthy
}
it
{
expect
(
Gitlab
::
GitRefValidator
.
validate
(
'my_new_feature'
)).
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
(
'#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
}
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
...
@@ -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
(
'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
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