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:
authorLuke Duncalfe <lduncalfe@gitlab.com>2019-06-19 20:51:57 +0300
committerMayra Cabrera <mcabrera@gitlab.com>2019-06-19 20:51:57 +0300
commitdcf811ba147a9d1c677fa626ca06639783d09717 (patch)
tree6e114055074385c4d057be651783134ab7b0f6ee /app/services/lfs
parent96c2949d6cfae23571f7d24c7b5ad1c22d759670 (diff)
CE backport for changes in EE MR 14017
This backports to CE changes to allow the EE model DesignManagement::Repository to override the #attributes_at method to provide its own git attributes. The #attributes_at method was freely available, as it's never called by anything in the app. It looks like the code that called it got refactored out of existence in ca66a04f. It was still being called in a spec https://gitlab.com/gitlab-org/gitlab-ce/blob/85b29c1c2fa3b94d7371cf454c485457a0756cb1/spec/services/files/create_service_spec.rb#L40 which I've left because with the change in Lfs::FileTransformer in fact is now again the perfect test! See EE MR https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14017 And these comment threads https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13894#note_178002089 https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13894#note_178049984
Diffstat (limited to 'app/services/lfs')
-rw-r--r--app/services/lfs/file_transformer.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/lfs/file_transformer.rb b/app/services/lfs/file_transformer.rb
index d1746399908..88f59b820a4 100644
--- a/app/services/lfs/file_transformer.rb
+++ b/app/services/lfs/file_transformer.rb
@@ -4,6 +4,14 @@ module Lfs
# Usage: Calling `new_file` check to see if a file should be in LFS and
# return a transformed result with `content` and `encoding` to commit.
#
+ # The `repository` passed to the initializer can be a Repository or
+ # a DesignManagement::Repository (an EE-specific class that inherits
+ # from Repository).
+ #
+ # The `repository_type` property will be one of the types named in
+ # `Gitlab::GlRepository.types`, and is recorded on the `LfsObjectsProject`
+ # in order to identify the repository location of the blob.
+ #
# For LFS an LfsObject linked to the project is stored and an LFS
# pointer returned. If the file isn't in LFS the untransformed content
# is returned to save in the commit.
@@ -52,7 +60,7 @@ module Lfs
end
def cached_attributes
- @cached_attributes ||= Gitlab::Git::AttributesAtRefParser.new(repository, branch_name)
+ @cached_attributes ||= repository.attributes_at(branch_name)
end
# rubocop: disable CodeReuse/ActiveRecord