mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 22:59:19 +10:00
Merge branch 'improve-multiple-branch-push-performance' into 'master'
Improve multiple branch push performance by memoizing permission checking See merge request !4091
This commit is contained in:
@@ -4,6 +4,7 @@ v 8.8.0 (unreleased)
|
||||
- Assign labels and milestone to target project when moving issue. !3934 (Long Nguyen)
|
||||
- Project#open_branches has been cleaned up and no longer loads entire records into memory.
|
||||
- Escape HTML in commit titles in system note messages
|
||||
- Improve multiple branch push performance by memoizing permission checking
|
||||
- Log to application.log when an admin starts and stops impersonating a user
|
||||
- Updated gitlab_git to 10.1.0
|
||||
- GitAccess#protected_tag? no longer loads all tags just to check if a single one exists
|
||||
|
||||
@@ -767,7 +767,7 @@ class Project < ActiveRecord::Base
|
||||
|
||||
# Check if current branch name is marked as protected in the system
|
||||
def protected_branch?(branch_name)
|
||||
protected_branches.where(name: branch_name).any?
|
||||
protected_branch_names.include?(branch_name)
|
||||
end
|
||||
|
||||
def developers_can_push_to_protected_branch?(branch_name)
|
||||
|
||||
@@ -122,6 +122,11 @@ module Gitlab
|
||||
build_status_object(true)
|
||||
end
|
||||
|
||||
def can_user_do_action?(action)
|
||||
@permission_cache ||= {}
|
||||
@permission_cache[action] ||= user.can?(action, project)
|
||||
end
|
||||
|
||||
def change_access_check(change)
|
||||
oldrev, newrev, ref = change.split(' ')
|
||||
|
||||
@@ -135,7 +140,7 @@ module Gitlab
|
||||
:push_code
|
||||
end
|
||||
|
||||
unless user.can?(action, project)
|
||||
unless can_user_do_action?(action)
|
||||
status =
|
||||
case action
|
||||
when :force_push_code_to_protected_branches
|
||||
|
||||
Reference in New Issue
Block a user