Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r--app/models/protected_branch.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 3df8fe31826..3d32144e0f8 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -26,7 +26,9 @@ class ProtectedBranch < ApplicationRecord
def self.protected?(project, ref_name)
return true if project.empty_repo? && project.default_branch_protected?
- self.matching(ref_name, protected_refs: protected_refs(project)).present?
+ Rails.cache.fetch("protected_ref-#{ref_name}-#{project.cache_key}") do
+ self.matching(ref_name, protected_refs: protected_refs(project)).present?
+ end
end
def self.allow_force_push?(project, ref_name)