Skip to content
Snippets Groups Projects
Commit dbaed90c authored by micael.bergeron's avatar micael.bergeron
Browse files

fix refactoring error with Blob.binary?

remove some lint
parent 5625b0e4
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -14,7 +14,7 @@ module Gitlab
ENCODING_CONFIDENCE_THRESHOLD = 50
 
#
#
#
def encode!(message)
return nil unless message.respond_to? :force_encoding
 
Loading
Loading
@@ -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
Loading
Loading
@@ -65,7 +65,7 @@ module Gitlab
clean(message)
end
end
private
 
def clean(message)
Loading
Loading
Loading
Loading
@@ -57,6 +57,10 @@ module Gitlab
end
end
 
def binary?(data)
EncodingHelper.libgit2_binary?(data)
end
private
 
# Recursive search of blob id by path
Loading
Loading
@@ -161,10 +165,6 @@ module Gitlab
end
end
end
def binary?(data)
EncodingHelper.libgit2_binary?(data)
end
end
 
def initialize(options)
Loading
Loading
Loading
Loading
@@ -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"
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment