Commit dbaed90c authored by micael.bergeron's avatar micael.bergeron

fix refactoring error with Blob.binary?

remove some lint
parent 5625b0e4
......@@ -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)
......
......@@ -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)
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment