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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
63186cd9
Commit
63186cd9
authored
Oct 16, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the default branch as branch name
parent
1fd476a0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
0 deletions
+15
-0
changelogs/unreleased-ee/bvl-allow-default-branch-as-branch-name.yml
...unreleased-ee/bvl-allow-default-branch-as-branch-name.yml
+5
-0
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+1
-0
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+9
-0
No files found.
changelogs/unreleased-ee/bvl-allow-default-branch-as-branch-name.yml
0 → 100644
View file @
63186cd9
---
title
:
Always allow the default branch as a branch name
merge_request
:
3154
author
:
type
:
fixed
lib/gitlab/checks/change_access.rb
View file @
63186cd9
...
...
@@ -185,6 +185,7 @@ module Gitlab
def
branch_name_allowed_by_push_rule?
(
push_rule
)
return
true
unless
push_rule
return
true
if
@branch_name
.
blank?
return
true
if
@branch_name
==
@project
.
default_branch
push_rule
.
branch_name_allowed?
(
@branch_name
)
end
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
63186cd9
...
...
@@ -266,6 +266,15 @@ describe Gitlab::Checks::ChangeAccess do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"Branch name does not follow the pattern '^(w*)$'"
)
end
end
context
'when the default branch does not match the push rules'
do
let
(
:push_rule
)
{
create
(
:push_rule
,
branch_name_regex:
'not-master'
)
}
let
(
:ref
)
{
"refs/heads/
#{
project
.
default_branch
}
"
}
it
'allows the default branch even if it does not match push rule'
do
expect
{
subject
}.
not_to
raise_error
end
end
end
context
'existing member rules'
do
...
...
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