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
c5f6aabb
Commit
c5f6aabb
authored
Mar 21, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
bbf7a1fd
7629421b
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
70 additions
and
38 deletions
+70
-38
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+0
-3
app/views/projects/_new_project_fields.html.haml
app/views/projects/_new_project_fields.html.haml
+4
-4
app/views/projects/protected_branches/shared/_index.html.haml
...views/projects/protected_branches/shared/_index.html.haml
+1
-1
changelogs/unreleased/59189-long-names-in-project-path-namespace-dropdown-breaks-past-container.yml
...project-path-namespace-dropdown-breaks-past-container.yml
+5
-0
changelogs/unreleased/59289-fix-push-to-create-protected-branches.yml
...nreleased/59289-fix-push-to-create-protected-branches.yml
+6
-0
doc/user/project/protected_branches.md
doc/user/project/protected_branches.md
+1
-1
lib/gitlab/checks/branch_check.rb
lib/gitlab/checks/branch_check.rb
+2
-0
spec/lib/gitlab/checks/branch_check_spec.rb
spec/lib/gitlab/checks/branch_check_spec.rb
+51
-29
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
c5f6aabb
...
...
@@ -18,12 +18,9 @@
}
.input-group
{
display
:
flex
;
.select2-container
{
display
:
unset
;
max-width
:
unset
;
width
:
unset
!
important
;
flex-grow
:
1
;
}
...
...
app/views/projects/_new_project_fields.html.haml
View file @
c5f6aabb
...
...
@@ -12,9 +12,9 @@
.form-group.project-path.col-sm-6
=
f
.
label
:namespace_id
,
class:
'label-bold'
do
%span
=
s_
(
"Project URL"
)
.input-group
.input-group
.flex-nowrap
-
if
current_user
.
can_select_namespace?
.input-group-prepend.has-tooltip
{
title:
root_url
}
.input-group-prepend.
flex-shrink-0.
has-tooltip
{
title:
root_url
}
.input-group-text
=
root_url
-
namespace_id
=
namespace_id_from
(
params
)
...
...
@@ -23,10 +23,10 @@
display_path:
true
,
extra_group:
namespace_id
),
{},
{
class:
'select2 js-select-namespace qa-project-namespace-select'
,
tabindex:
1
,
data:
{
track_label:
"
#{
track_label
}
"
,
track_event:
"activate_form_input"
,
track_property:
"project_path"
,
track_value:
""
}})
{
class:
'select2 js-select-namespace qa-project-namespace-select
block-truncated
'
,
tabindex:
1
,
data:
{
track_label:
"
#{
track_label
}
"
,
track_event:
"activate_form_input"
,
track_property:
"project_path"
,
track_value:
""
}})
-
else
.input-group-prepend.static-namespace.has-tooltip
{
title:
user_url
(
current_user
.
username
)
+
'/'
}
.input-group-prepend.static-namespace.
flex-shrink-0.
has-tooltip
{
title:
user_url
(
current_user
.
username
)
+
'/'
}
.input-group-text.border-0
#{
user_url
(
current_user
.
username
)
}
/
=
f
.
hidden_field
:namespace_id
,
value:
current_user
.
namespace_id
...
...
app/views/projects/protected_branches/shared/_index.html.haml
View file @
c5f6aabb
...
...
@@ -12,7 +12,7 @@
%p
By default, protected branches are designed to:
%ul
%li
prevent their creation, if not already created, from everybody except
users who are allowed to merge
%li
prevent their creation, if not already created, from everybody except
Maintainers
%li
prevent pushes from everybody except Maintainers
%li
prevent
<strong>
anyone
</strong>
from force pushing to the branch
%li
prevent
<strong>
anyone
</strong>
from deleting the branch
...
...
changelogs/unreleased/59189-long-names-in-project-path-namespace-dropdown-breaks-past-container.yml
0 → 100644
View file @
c5f6aabb
---
title
:
Prevent namespace dropdown in new project form from exceeding container
merge_request
:
26343
author
:
type
:
fixed
changelogs/unreleased/59289-fix-push-to-create-protected-branches.yml
0 → 100644
View file @
c5f6aabb
---
title
:
Allow users who can push to protected branches to create protected branches
via CLI
merge_request
:
26413
author
:
type
:
fixed
doc/user/project/protected_branches.md
View file @
c5f6aabb
...
...
@@ -10,7 +10,7 @@ created protected branches.
By default, a protected branch does four simple things:
-
it prevents its creation, if not already created, from everybody except users
w
ho are allowed to merge
w
ith Maintainer permission
-
it prevents pushes from everybody except users with Maintainer permission
-
it prevents
**anyone**
from force pushing to the branch
-
it prevents
**anyone**
from deleting the branch
...
...
lib/gitlab/checks/branch_check.rb
View file @
c5f6aabb
...
...
@@ -59,6 +59,8 @@ module Gitlab
def
protected_branch_creation_checks
logger
.
log_timed
(
LOG_MESSAGES
[
:protected_branch_creation_checks
])
do
break
if
user_access
.
can_push_to_branch?
(
branch_name
)
unless
user_access
.
can_merge_to_branch?
(
branch_name
)
raise
GitAccess
::
UnauthorizedError
,
ERROR_MESSAGES
[
:create_protected_branch
]
end
...
...
spec/lib/gitlab/checks/branch_check_spec.rb
View file @
c5f6aabb
...
...
@@ -108,7 +108,28 @@ describe Gitlab::Checks::BranchCheck do
end
context
'protected branch creation feature is enabled'
do
context
'user is not allowed to create protected branches'
do
context
'user can push to branch'
do
before
do
allow
(
user_access
)
.
to
receive
(
:can_push_to_branch?
)
.
with
(
'feature'
)
.
and_return
(
true
)
end
it
'does not raise an error'
do
expect
{
subject
.
validate!
}.
not_to
raise_error
end
end
context
'user cannot push to branch'
do
before
do
allow
(
user_access
)
.
to
receive
(
:can_push_to_branch?
)
.
with
(
'feature'
)
.
and_return
(
false
)
end
context
'user cannot merge to branch'
do
before
do
allow
(
user_access
)
.
to
receive
(
:can_merge_to_branch?
)
...
...
@@ -121,7 +142,7 @@ describe Gitlab::Checks::BranchCheck do
end
end
context
'user is allowed to create protected branches
'
do
context
'user can merge to branch
'
do
before
do
allow
(
user_access
)
.
to
receive
(
:can_merge_to_branch?
)
...
...
@@ -172,6 +193,7 @@ describe Gitlab::Checks::BranchCheck do
end
end
end
end
context
'branch deletion'
do
let
(
:newrev
)
{
'0000000000000000000000000000000000000000'
}
...
...
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