From a4ba973e24ef6767d635c0291c9b6ce8085aef28 Mon Sep 17 00:00:00 2001 From: Mark Chao Date: Thu, 4 Oct 2018 17:16:51 +0800 Subject: Allow FoundBlob to access language from gitattributes Extract language_from_git_attributes as a concern so it can ben included in two blob classes. --- app/models/blob.rb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'app/models/blob.rb') 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 -- cgit v1.2.3