BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ca66a04f
Commit
ca66a04f
authored
Mar 11, 2018
by
James Edwards-Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lfs::FileTranformer caches .gitattributes parser
Prevents `.gitattributes` blob lookup being repeated for every file checked at a given ref
parent
237a32cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
file_transformer.rb
app/services/lfs/file_transformer.rb
+5
-1
repository.rb
lib/gitlab/git/repository.rb
+3
-2
No files found.
app/services/lfs/file_transformer.rb
View file @
ca66a04f
...
...
@@ -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
)
...
...
lib/gitlab/git/repository.rb
View file @
ca66a04f
...
...
@@ -1002,8 +1002,9 @@ module Gitlab
# This only checks the root .gitattributes file,
# it does not traverse subfolders to find additional .gitattributes files
#
# This method is around 30 times slower than `attributes`,
# which uses `$GIT_DIR/info/attributes`
# This method is around 30 times slower than `attributes`, which uses
# `$GIT_DIR/info/attributes`. Consider caching AttributesAtRefParser
# and reusing that for multiple calls instead of this method.
def
attributes_at
(
ref
,
file_path
)
parser
=
AttributesAtRefParser
.
new
(
self
,
ref
)
parser
.
attributes
(
file_path
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment