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

fix refactoring error with Blob.binary?

remove some lint
parent 5625b0e4
...@@ -33,12 +33,12 @@ module Gitlab ...@@ -33,12 +33,12 @@ module Gitlab
# encode and clean the bad chars # encode and clean the bad chars
message.replace clean(message) message.replace clean(message)
rescue => e rescue
encoding = detect ? detect[:encoding] : "unknown" encoding = detect ? detect[:encoding] : "unknown"
"--broken encoding: #{encoding}" "--broken encoding: #{encoding}"
end end
def all_binary?(data, detect=nil) def all_binary?(data, detect = nil)
detect ||= CharlockHolmes::EncodingDetector.detect(data) detect ||= CharlockHolmes::EncodingDetector.detect(data)
detect && detect[:type] == :binary detect && detect[:type] == :binary
end end
......
...@@ -57,6 +57,10 @@ module Gitlab ...@@ -57,6 +57,10 @@ module Gitlab
end end
end end
def binary?(data)
EncodingHelper.libgit2_binary?(data)
end
private private
# Recursive search of blob id by path # Recursive search of blob id by path
...@@ -161,10 +165,6 @@ module Gitlab ...@@ -161,10 +165,6 @@ module Gitlab
end end
end end
end end
def binary?(data)
EncodingHelper.libgit2_binary?(data)
end
end end
def initialize(options) def initialize(options)
......
...@@ -201,7 +201,7 @@ module Gitlab ...@@ -201,7 +201,7 @@ module Gitlab
return @diff unless all_binary?(@diff) return @diff unless all_binary?(@diff)
# the diff is binary, let's make a message for it # 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 end
private 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