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:
authorMark Chao <mchao@gitlab.com>2018-10-04 12:16:51 +0300
committerMark Chao <mchao@gitlab.com>2018-10-30 10:44:55 +0300
commita4ba973e24ef6767d635c0291c9b6ce8085aef28 (patch)
tree28efdf13b834db6267fd8bd64d798d8e694b0109 /app/models/blob.rb
parentbc14e4ed1024efa1e0a411bd59e1339fb1af20c0 (diff)
Allow FoundBlob to access language from gitattributes
Extract language_from_git_attributes as a concern so it can ben included in two blob classes.
Diffstat (limited to 'app/models/blob.rb')
-rw-r--r--app/models/blob.rb8
1 files changed, 1 insertions, 7 deletions
diff --git a/app/models/blob.rb b/app/models/blob.rb
index 57c813e3775..4f310e70f4f 100644
--- a/app/models/blob.rb
+++ b/app/models/blob.rb
@@ -3,6 +3,7 @@
# Blob is a Rails-specific wrapper around Gitlab::Git::Blob, SnippetBlob and Ci::ArtifactBlob
class Blob < SimpleDelegator
include Presentable
+ include BlobLanguageFromGitAttributes
CACHE_TIME = 60 # Cache raw blobs referred to by a (mutable) ref for 1 minute
CACHE_TIME_IMMUTABLE = 3600 # Cache blobs referred to by an immutable reference for 1 hour
@@ -180,13 +181,6 @@ class Blob < SimpleDelegator
Gitlab::FileDetector.type_of(path) || Gitlab::FileDetector.type_of(name)
end
- def language_from_gitattributes
- return nil unless project
-
- repository = project.repository
- repository.gitattribute(path, 'gitlab-language')
- end
-
def video?
UploaderHelper::VIDEO_EXT.include?(extension)
end