summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-11 19:17:39 +0000
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2018-03-15 21:49:01 +0000
commitca66a04ffec2e311e72b5bdd2c68d3286ef6631c (patch)
tree95d7a0903f3aa3d7ab6cb25792043b3bde9ca6cb /app
parent237a32cc90d7e2c4b96e3a9ba0fd9e77ff3fc166 (diff)
downloadgitlab-ce-ca66a04ffec2e311e72b5bdd2c68d3286ef6631c.tar.gz
Lfs::FileTranformer caches .gitattributes parser
Prevents `.gitattributes` blob lookup being repeated for every file checked at a given ref
Diffstat (limited to 'app')
-rw-r--r--app/services/lfs/file_transformer.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/lfs/file_transformer.rb b/app/services/lfs/file_transformer.rb
index 0235d07e529..bdb2f1bea42 100644
--- a/app/services/lfs/file_transformer.rb
+++ b/app/services/lfs/file_transformer.rb
@@ -36,7 +36,11 @@ module Lfs
private
def lfs_file?(file_path)
- repository.attributes_at(branch_name, file_path)['filter'] == 'lfs'
+ cached_attributes.attributes(file_path)['filter'] == 'lfs'
+ end
+
+ def cached_attributes
+ @cached_attributes ||= Gitlab::Git::AttributesAtRefParser.new(repository, branch_name)
end
def create_lfs_object!(lfs_pointer_file, file_content)