diff options
author | micael.bergeron <micael.bergeron@solutionstlm.com> | 2017-09-04 15:32:57 -0400 |
---|---|---|
committer | micael.bergeron <micael.bergeron@solutionstlm.com> | 2017-09-06 09:01:53 -0400 |
commit | dbaed90c8d3dffb2dd970f1621f551dd322db5ee (patch) | |
tree | 61f3a92dff29e8229a224da5e864f5504bf366ab /lib | |
parent | 5625b0e4534de834235ce5dbeef89a5e976b698c (diff) | |
download | gitlab-ce-dbaed90c8d3dffb2dd970f1621f551dd322db5ee.tar.gz |
fix refactoring error with Blob.binary?
remove some lint
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/encoding_helper.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/git/blob.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/git/diff.rb | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb index 21a14141c87..8ac756a0b6a 100644 --- a/lib/gitlab/encoding_helper.rb +++ b/lib/gitlab/encoding_helper.rb @@ -14,7 +14,7 @@ module Gitlab ENCODING_CONFIDENCE_THRESHOLD = 50 # - # + # def encode!(message) return nil unless message.respond_to? :force_encoding @@ -33,12 +33,12 @@ module Gitlab # encode and clean the bad chars message.replace clean(message) - rescue => e + rescue encoding = detect ? detect[:encoding] : "unknown" "--broken encoding: #{encoding}" end - def all_binary?(data, detect=nil) + def all_binary?(data, detect = nil) detect ||= CharlockHolmes::EncodingDetector.detect(data) detect && detect[:type] == :binary end @@ -65,7 +65,7 @@ module Gitlab clean(message) end end - + private def clean(message) diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index 2e6edb8be0d..e5391b8bf8a 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -57,6 +57,10 @@ module Gitlab end end + def binary?(data) + EncodingHelper.libgit2_binary?(data) + end + private # Recursive search of blob id by path @@ -161,10 +165,6 @@ module Gitlab end end end - - def binary?(data) - EncodingHelper.libgit2_binary?(data) - end end def initialize(options) diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb index 17defe55af0..b3237d5496a 100644 --- a/lib/gitlab/git/diff.rb +++ b/lib/gitlab/git/diff.rb @@ -118,7 +118,7 @@ module Gitlab end # Return a binary diff message like: - # + # # "Binary files a/file/path and b/file/path differ\n" def binary_message(old_path, new_path) "Binary files #{old_path} and #{new_path} differ\n" @@ -201,7 +201,7 @@ module Gitlab return @diff unless all_binary?(@diff) # the diff is binary, let's make a message for it - Diff::binary_message(@old_path, @new_path) + Diff.binary_message(@old_path, @new_path) end private |