summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/blob.rb
diff options
context:
space:
mode:
authormicael.bergeron <micael.bergeron@solutionstlm.com>2017-09-04 13:34:15 -0400
committermicael.bergeron <micael.bergeron@solutionstlm.com>2017-09-06 09:01:53 -0400
commitc9aa7932152bd10f6fc7b87b3263922aa4b911b7 (patch)
treedea1ae4b101ca182eefa16b8b88c8b46308071bf /lib/gitlab/git/blob.rb
parentbca72f5906ed38dc231ef066231238758c1cb42d (diff)
downloadgitlab-ce-c9aa7932152bd10f6fc7b87b3263922aa4b911b7.tar.gz
revert to using a simple representation
Diffstat (limited to 'lib/gitlab/git/blob.rb')
-rw-r--r--lib/gitlab/git/blob.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index 7780f4e4d4f..2e6edb8be0d 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -42,14 +42,6 @@ module Gitlab
end
end
- def binary?(data)
- # EncodingDetector checks the first 1024 * 1024 bytes for NUL byte, libgit2 checks
- # only the first 8000 (https://github.com/libgit2/libgit2/blob/2ed855a9e8f9af211e7274021c2264e600c0f86b/src/filter.h#L15),
- # which is what we use below to keep a consistent behavior.
- detect = CharlockHolmes::EncodingDetector.new(8000).detect(data)
- detect && detect[:type] == :binary
- end
-
# Returns an array of Blob instances, specified in blob_references as
# [[commit_sha, path], [commit_sha, path], ...]. If blob_size_limit < 0 then the
# full blob contents are returned. If blob_size_limit >= 0 then each blob will
@@ -169,6 +161,10 @@ module Gitlab
end
end
end
+
+ def binary?(data)
+ EncodingHelper.libgit2_binary?(data)
+ end
end
def initialize(options)