diff options
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r-- | lib/gitlab/checks/lfs_integrity.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/checks/snippet_check.rb | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/gitlab/checks/lfs_integrity.rb b/lib/gitlab/checks/lfs_integrity.rb index e18cf6ff8f2..78952db7a3e 100644 --- a/lib/gitlab/checks/lfs_integrity.rb +++ b/lib/gitlab/checks/lfs_integrity.rb @@ -17,7 +17,7 @@ module Gitlab return false unless new_lfs_pointers.present? - existing_count = @project.all_lfs_objects + existing_count = @project.lfs_objects .for_oids(new_lfs_pointers.map(&:lfs_oid)) .count diff --git a/lib/gitlab/checks/snippet_check.rb b/lib/gitlab/checks/snippet_check.rb index bcecd0fc251..8c61b782baa 100644 --- a/lib/gitlab/checks/snippet_check.rb +++ b/lib/gitlab/checks/snippet_check.rb @@ -3,7 +3,6 @@ module Gitlab module Checks class SnippetCheck < BaseChecker - DEFAULT_BRANCH = 'master'.freeze ERROR_MESSAGES = { create_delete_branch: 'You can not create or delete branches.' }.freeze @@ -11,17 +10,18 @@ module Gitlab ATTRIBUTES = %i[oldrev newrev ref branch_name tag_name logger].freeze attr_reader(*ATTRIBUTES) - def initialize(change, logger:) + def initialize(change, default_branch:, logger:) @oldrev, @newrev, @ref = change.values_at(:oldrev, :newrev, :ref) @branch_name = Gitlab::Git.branch_name(@ref) @tag_name = Gitlab::Git.tag_name(@ref) + @default_branch = default_branch @logger = logger @logger.append_message("Running checks for ref: #{@branch_name || @tag_name}") end def validate! - if creation? || deletion? + if !@default_branch || creation? || deletion? raise GitAccess::ForbiddenError, ERROR_MESSAGES[:create_delete_branch] end @@ -31,7 +31,7 @@ module Gitlab private def creation? - @branch_name != DEFAULT_BRANCH && super + @branch_name != @default_branch && super end end end |