Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r--app/models/repository.rb21
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)