diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /app/models/repository.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 93f22dbe122..c19448332f8 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -24,10 +24,10 @@ class Repository attr_accessor :full_path, :shard, :disk_path, :container, :repo_type - delegate :ref_name_for_sha, to: :raw_repository - delegate :bundle_to_disk, to: :raw_repository delegate :lfs_enabled?, to: :container + delegate_missing_to :raw_repository + CreateTreeError = Class.new(StandardError) AmbiguousRefError = Class.new(StandardError) @@ -386,10 +386,6 @@ class Repository raw_repository.expire_has_local_branches_cache end - def lookup_cache - @lookup_cache ||= {} - end - def expire_exists_cache expire_method_caches(%i(exists?)) end @@ -494,19 +490,12 @@ class Repository expire_branches_cache if expire_cache end - def method_missing(msg, *args, &block) - if msg == :lookup && !block_given? - lookup_cache[msg] ||= {} - lookup_cache[msg][args.join(":")] ||= raw_repository.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend - else - raw_repository.__send__(msg, *args, &block) # rubocop:disable GitlabSecurity/PublicSend + def lookup(sha) + strong_memoize("lookup_#{sha}") do + raw_repository.lookup(sha) end end - def respond_to_missing?(method, include_private = false) - raw_repository.respond_to?(method, include_private) || super - end - def blob_at(sha, path) blob = Blob.decorate(raw_repository.blob_at(sha, path), container) |