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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
98b5c364
Commit
98b5c364
authored
Dec 30, 2011
by
Saito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use monkey patch to trancoding content
parent
26deb7e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
config/initializers/gitlabhq/20_grit_ext.rb
config/initializers/gitlabhq/20_grit_ext.rb
+18
-0
No files found.
config/initializers/gitlabhq/20_grit_ext.rb
View file @
98b5c364
...
...
@@ -7,5 +7,23 @@ Grit::Blob.class_eval do
include
Utils
::
Colorize
end
#monkey patch raw_object from string
Grit
::
GitRuby
::
Internal
::
RawObject
.
class_eval
do
def
content
transcoding
(
@content
)
end
private
def
transcoding
(
content
)
content
||=
""
detection
=
CharlockHolmes
::
EncodingDetector
.
detect
(
content
)
if
hash
=
detection
content
=
CharlockHolmes
::
Converter
.
convert
(
content
,
hash
[
:encoding
],
'UTF-8'
)
if
hash
[
:encoding
]
end
content
end
end
Grit
::
Git
.
git_timeout
=
GIT_OPTS
[
"git_timeout"
]
Grit
::
Git
.
git_max_size
=
GIT_OPTS
[
"git_max_size"
]
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