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
351fde1b
Commit
351fde1b
authored
Oct 05, 2017
by
Jacob Schatz
Committed by
Stan Hu
Oct 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent branches or tags from starting with invalid characters (e.g. -, .)
Closes #38817
parent
2e76b8a9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
valid-branch-name-dash-bug.yml
changelogs/unreleased/valid-branch-name-dash-bug.yml
+5
-0
git_ref_validator.rb
lib/gitlab/git_ref_validator.rb
+1
-1
git_ref_validator_spec.rb
spec/lib/gitlab/git_ref_validator_spec.rb
+5
-0
No files found.
changelogs/unreleased/valid-branch-name-dash-bug.yml
0 → 100644
View file @
351fde1b
---
title
:
Prevent branches or tags from starting with invalid characters (e.g. -, .)
merge_request
:
author
:
type
:
fixed
lib/gitlab/git_ref_validator.rb
View file @
351fde1b
...
@@ -11,7 +11,7 @@ module Gitlab
...
@@ -11,7 +11,7 @@ module Gitlab
return
false
if
ref_name
.
start_with?
(
'refs/remotes/'
)
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
--branch
#{
ref_name
}
)
)
end
end
end
end
end
end
spec/lib/gitlab/git_ref_validator_spec.rb
View file @
351fde1b
...
@@ -4,6 +4,7 @@ describe Gitlab::GitRefValidator do
...
@@ -4,6 +4,7 @@ describe Gitlab::GitRefValidator do
it
{
expect
(
described_class
.
validate
(
'feature/new'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'feature/new'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'implement_@all'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'implement_@all'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'my_new_feature'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'my_new_feature'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'my-branch'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'#1'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'#1'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'feature/refs/heads/foo'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'feature/refs/heads/foo'
)).
to
be_truthy
}
it
{
expect
(
described_class
.
validate
(
'feature/~new/'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'feature/~new/'
)).
to
be_falsey
}
...
@@ -22,4 +23,8 @@ describe Gitlab::GitRefValidator do
...
@@ -22,4 +23,8 @@ describe Gitlab::GitRefValidator do
it
{
expect
(
described_class
.
validate
(
'refs/remotes/'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'refs/remotes/'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'refs/heads/feature'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'refs/heads/feature'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'refs/remotes/origin'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'refs/remotes/origin'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'-'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'-branch'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'.tag'
)).
to
be_falsey
}
it
{
expect
(
described_class
.
validate
(
'my branch'
)).
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