2021-09-04 01:27:46 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class BaseSingleChecker < BaseChecker
|
|
|
|
attr_reader :change_access
|
2022-05-07 20:08:51 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
delegate(*SingleChangeAccess::ATTRIBUTES, :branch_ref?, :tag_ref?, to: :change_access)
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
def initialize(change_access)
|
|
|
|
@change_access = change_access
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def creation?
|
|
|
|
Gitlab::Git.blank_ref?(oldrev)
|
|
|
|
end
|
|
|
|
|
|
|
|
def deletion?
|
|
|
|
Gitlab::Git.blank_ref?(newrev)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
|
|
|
!creation? && !deletion?
|
|
|
|
end
|
|
|
|
|
|
|
|
def tag_exists?
|
|
|
|
project.repository.tag_exists?(tag_name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|