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
c2823a4b
Commit
c2823a4b
authored
Apr 04, 2018
by
Jan
Committed by
Rémy Coutable
Apr 04, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Protected branches count is wrong when a wildcard includes several protected branches"
parent
6587a0cd
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
6 deletions
+21
-6
repository_controller.rb
app/controllers/projects/settings/repository_controller.rb
+4
-0
_branches_list.html.haml
...ojects/protected_branches/shared/_branches_list.html.haml
+2
-2
_tags_list.html.haml
...views/projects/protected_tags/shared/_tags_list.html.haml
+2
-2
20394-protected-branches-wildcard.yml
changelogs/unreleased/20394-protected-branches-wildcard.yml
+5
-0
protected_branches_spec.rb
spec/features/protected_branches_spec.rb
+4
-1
protected_tags_spec.rb
spec/features/protected_tags_spec.rb
+4
-1
No files found.
app/controllers/projects/settings/repository_controller.rb
View file @
c2823a4b
...
...
@@ -16,6 +16,10 @@ module Projects
@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 @
c2823a4b
...
...
@@ -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 @
c2823a4b
...
...
@@ -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 @
c2823a4b
---
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 @
c2823a4b
...
...
@@ -142,7 +142,10 @@ feature 'Protected Branches', :js do
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 @
c2823a4b
...
...
@@ -65,7 +65,10 @@ feature 'Protected Tags', :js do
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