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
efc89795
Commit
efc89795
authored
Sep 11, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix when pushing without a branch name
parent
fd326fc3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
lib/gitlab/checks/change_access.rb
lib/gitlab/checks/change_access.rb
+1
-1
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+8
-0
No files found.
lib/gitlab/checks/change_access.rb
View file @
efc89795
...
@@ -177,7 +177,7 @@ module Gitlab
...
@@ -177,7 +177,7 @@ module Gitlab
def
branch_name_allowed_by_push_rule?
(
push_rule
)
def
branch_name_allowed_by_push_rule?
(
push_rule
)
return
true
unless
push_rule
return
true
unless
push_rule
return
true
if
@branch_name
.
empty
?
return
true
if
@branch_name
.
blank
?
push_rule
.
branch_name_allowed?
(
@branch_name
)
push_rule
.
branch_name_allowed?
(
@branch_name
)
end
end
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
efc89795
...
@@ -249,6 +249,14 @@ describe Gitlab::Checks::ChangeAccess do
...
@@ -249,6 +249,14 @@ describe Gitlab::Checks::ChangeAccess do
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"Branch name does not follow the pattern '^(w*)$'"
)
expect
{
subject
}.
to
raise_error
(
Gitlab
::
GitAccess
::
UnauthorizedError
,
"Branch name does not follow the pattern '^(w*)$'"
)
end
end
context
'when the ref is not a branch ref'
do
let
(
:ref
)
{
'a/ref/thats/not/abranch'
}
it
'allows the creation'
do
expect
{
subject
}.
not_to
raise_error
end
end
context
'when no commits are present'
do
context
'when no commits are present'
do
before
do
before
do
allow
(
project
.
repository
).
to
receive
(
:new_commits
)
{
[]
}
allow
(
project
.
repository
).
to
receive
(
:new_commits
)
{
[]
}
...
...
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