diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-08-03 16:24:26 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-10-13 03:17:30 +0300 |
commit | 399056ed783e12337a9c47b06b4aae021198f1cd (patch) | |
tree | 21645fa92b300735c5431608e17f3e34b34ce653 /lib/gitlab/git | |
parent | a5ecb5bbdac05c3b1a96ecb918ce6a4ceed37d75 (diff) |
Remove dependencies on Linguist
This saves about 128 MB of baseline RAM usage per Unicorn and
Sidekiq process (!).
Linguist wasn't detecting languages anymore from CE/EE since
9ae8b57467ac8b38f1fa9020a466d94a93cbb9dd. However, Linguist::BlobHelper
was still being depended on by BlobLike and others.
This removes the Linguist gem, given it isn't required anymore.
EscapeUtils were pulled in as dependency, but given Banzai depends on
it, it is now added explicitly.
Previously, Linguist was used to detect the best ACE mode. Instead,
we rely on ACE to guess the best mode based on the file extension.
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/blob.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/git/blob_snippet.rb | 34 |
2 files changed, 4 insertions, 38 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index 71857bd2d87..13b0bb930f4 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -3,13 +3,13 @@ module Gitlab module Git class Blob - include Linguist::BlobHelper + include Gitlab::BlobHelper include Gitlab::EncodingHelper # This number is the maximum amount of data that we want to display to - # the user. We load as much as we can for encoding detection - # (Linguist) and LFS pointer parsing. All other cases where we need full - # blob data should use load_all_data!. + # the user. We load as much as we can for encoding detection and LFS + # pointer parsing. All other cases where we need full blob data should + # use load_all_data!. MAX_DATA_DISPLAY_SIZE = 10.megabytes # These limits are used as a heuristic to ignore files which can't be LFS diff --git a/lib/gitlab/git/blob_snippet.rb b/lib/gitlab/git/blob_snippet.rb deleted file mode 100644 index 68116e775c6..00000000000 --- a/lib/gitlab/git/blob_snippet.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Gitaly note: JV: no RPC's here. - -module Gitlab - module Git - class BlobSnippet - include Linguist::BlobHelper - - attr_accessor :ref - attr_accessor :lines - attr_accessor :filename - attr_accessor :startline - - def initialize(ref, lines, startline, filename) - @ref, @lines, @startline, @filename = ref, lines, startline, filename - end - - def data - lines&.join("\n") - end - - def name - filename - end - - def size - data.length - end - - def mode - nil - end - end - end -end |