Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
58c07ff0c8ed
Commit
d7cfc338
authored
Apr 04, 2018
by
Jan
Committed by
Rémy Coutable
Apr 04, 2018
Browse files
Resolve "Protected branches count is wrong when a wildcard includes several protected branches"
parent
4e8636acf68a
Changes
6
Hide whitespace changes
Inline
Side-by-side
app/controllers/projects/settings/repository_controller.rb
View file @
58c07ff0
...
...
@@ -16,6 +16,10 @@ def define_protected_refs
@protected_tags
=
@project
.
protected_tags
.
order
(
:name
).
page
(
params
[
:page
])
@protected_branch
=
@project
.
protected_branches
.
new
@protected_tag
=
@project
.
protected_tags
.
new
@protected_branches_count
=
@protected_branches
.
reduce
(
0
)
{
|
sum
,
branch
|
sum
+
branch
.
matching
(
@project
.
repository
.
branches
).
size
}
@protected_tags_count
=
@protected_tags
.
reduce
(
0
)
{
|
sum
,
tag
|
sum
+
tag
.
matching
(
@project
.
repository
.
tags
).
size
}
load_gon_index
end
...
...
app/views/projects/protected_branches/shared/_branches_list.html.haml
View file @
58c07ff0
...
...
@@ -2,7 +2,7 @@
-
if
@protected_branches
.
empty?
.panel-heading
%h3
.panel-title
Protected branch (
#{
@protected_branches
.
size
}
)
Protected branch (
#{
@protected_branches
_count
}
)
%p
.settings-message.text-center
There are currently no protected branches, protect a branch with the form above.
-
else
...
...
@@ -16,7 +16,7 @@
%col
%thead
%tr
%th
Protected branch (
#{
@protected_branches
.
size
}
)
%th
Protected branch (
#{
@protected_branches
_count
}
)
%th
Last commit
%th
Allowed to merge
%th
Allowed to push
...
...
app/views/projects/protected_tags/shared/_tags_list.html.haml
View file @
58c07ff0
...
...
@@ -2,7 +2,7 @@
-
if
@protected_tags
.
empty?
.panel-heading
%h3
.panel-title
Protected tag (
#{
@protected_tags
.
size
}
)
Protected tag (
#{
@protected_tags
_count
}
)
%p
.settings-message.text-center
There are currently no protected tags, protect a tag with the form above.
-
else
...
...
@@ -17,7 +17,7 @@
%col
%thead
%tr
%th
Protected tag (
#{
@protected_tags
.
size
}
)
%th
Protected tag (
#{
@protected_tags
_count
}
)
%th
Last commit
%th
Allowed to create
-
if
can_admin_project
...
...
changelogs/unreleased/20394-protected-branches-wildcard.yml
0 → 100644
View file @
58c07ff0
---
title
:
Include matching branches and tags in protected branches / tags count
merge_request
:
author
:
Jan Beckmann
type
:
fixed
spec/features/protected_branches_spec.rb
View file @
58c07ff0
...
...
@@ -142,7 +142,10 @@
set_protected_branch_name
(
'*-stable'
)
click_on
"Protect"
within
(
".protected-branches-list"
)
{
expect
(
page
).
to
have_content
(
"2 matching branches"
)
}
within
(
".protected-branches-list"
)
do
expect
(
page
).
to
have_content
(
"Protected branch (2)"
)
expect
(
page
).
to
have_content
(
"2 matching branches"
)
end
end
it
"displays all the branches matching the wildcard"
do
...
...
spec/features/protected_tags_spec.rb
View file @
58c07ff0
...
...
@@ -65,7 +65,10 @@ def set_protected_tag_name(tag_name)
set_protected_tag_name
(
'*-stable'
)
click_on
"Protect"
within
(
".protected-tags-list"
)
{
expect
(
page
).
to
have_content
(
"2 matching tags"
)
}
within
(
".protected-tags-list"
)
do
expect
(
page
).
to
have_content
(
"Protected tag (2)"
)
expect
(
page
).
to
have_content
(
"2 matching tags"
)
end
end
it
"displays all the tags matching the wildcard"
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