Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
dbaed90c
Commit
dbaed90c
authored
Sep 04, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix refactoring error with Blob.binary?
remove some lint
parent
5625b0e4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
lib/gitlab/encoding_helper.rb
lib/gitlab/encoding_helper.rb
+4
-4
lib/gitlab/git/blob.rb
lib/gitlab/git/blob.rb
+4
-4
lib/gitlab/git/diff.rb
lib/gitlab/git/diff.rb
+2
-2
No files found.
lib/gitlab/encoding_helper.rb
View file @
dbaed90c
...
@@ -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
...
...
lib/gitlab/git/blob.rb
View file @
dbaed90c
...
@@ -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
)
...
...
lib/gitlab/git/diff.rb
View file @
dbaed90c
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment