summaryrefslogtreecommitdiff
path: root/app/controllers/projects/settings/repository_controller.rb
diff options
context:
space:
mode:
authorJan <king-jan1999@hotmail.de>2018-04-04 10:37:44 +0000
committerRémy Coutable <remy@rymai.me>2018-04-04 10:37:44 +0000
commitc2823a4bda24c2d78219fc47c472276e4cfd7404 (patch)
treedb050a39442f8474aeca27102b9a6c9327d18a38 /app/controllers/projects/settings/repository_controller.rb
parent6587a0cdbbe917042e0eecfed67e533f73db7372 (diff)
downloadgitlab-ce-c2823a4bda24c2d78219fc47c472276e4cfd7404.tar.gz
Resolve "Protected branches count is wrong when a wildcard includes several protected branches"
Diffstat (limited to 'app/controllers/projects/settings/repository_controller.rb')
-rw-r--r--app/controllers/projects/settings/repository_controller.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/controllers/projects/settings/repository_controller.rb b/app/controllers/projects/settings/repository_controller.rb
index d06d18c498b..dd9e4a2af3e 100644
--- a/app/controllers/projects/settings/repository_controller.rb
+++ b/app/controllers/projects/settings/repository_controller.rb
@@ -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