7e6f6e1603
Enables frozens string for the following: * lib/gitlab/conflict/**/*.rb * lib/gitlab/cross_project_access/**/*.rb * lib/gitlab/cycle_analytics/**/*.rb * lib/gitlab/data_builder/**/*.rb * lib/gitlab/database/**/*.rb * lib/gitlab/dependency_linker/**/*.rb * lib/gitlab/diff/**/*.rb * lib/gitlab/downtime_check/**/*.rb * lib/gitlab/email/**/*.rb * lib/gitlab/etag_caching/**/*.rb Partially addresses gitlab-org/gitlab-ce#47424.
53 lines
1.1 KiB
Ruby
53 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module Gitlab
|
|
module Diff
|
|
module FileCollection
|
|
class MergeRequestDiff < Base
|
|
extend ::Gitlab::Utils::Override
|
|
|
|
def initialize(merge_request_diff, diff_options:)
|
|
@merge_request_diff = merge_request_diff
|
|
|
|
super(merge_request_diff,
|
|
project: merge_request_diff.project,
|
|
diff_options: diff_options,
|
|
diff_refs: merge_request_diff.diff_refs,
|
|
fallback_diff_refs: merge_request_diff.fallback_diff_refs)
|
|
end
|
|
|
|
def diff_files
|
|
diff_files = super
|
|
|
|
diff_files.each { |diff_file| cache.decorate(diff_file) }
|
|
|
|
diff_files
|
|
end
|
|
|
|
override :write_cache
|
|
def write_cache
|
|
cache.write_if_empty
|
|
end
|
|
|
|
override :clear_cache
|
|
def clear_cache
|
|
cache.clear
|
|
end
|
|
|
|
def cache_key
|
|
cache.key
|
|
end
|
|
|
|
def real_size
|
|
@merge_request_diff.real_size
|
|
end
|
|
|
|
private
|
|
|
|
def cache
|
|
@cache ||= Gitlab::Diff::HighlightCache.new(self)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|