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
Tatuya Kamada
gitlab-ce
Commits
e1d1673e
Commit
e1d1673e
authored
May 29, 2012
by
Saito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
monkey patch grit to support utf8 encoding
parent
206230a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
config/initializers/gitlabhq/20_grit_ext.rb
config/initializers/gitlabhq/20_grit_ext.rb
+17
-10
No files found.
config/initializers/gitlabhq/20_grit_ext.rb
View file @
e1d1673e
require
'grit'
require
'grit'
require
'pygments'
require
'pygments'
Grit
::
Git
.
git_timeout
=
GIT_OPTS
[
"git_timeout"
]
Grit
::
Git
.
git_max_size
=
GIT_OPTS
[
"git_max_size"
]
Grit
::
Blob
.
class_eval
do
Grit
::
Blob
.
class_eval
do
include
Linguist
::
BlobHelper
include
Linguist
::
BlobHelper
end
#monkey patch raw_object from string
def
data
Grit
::
GitRuby
::
Internal
::
RawObject
.
class_eval
do
@data
||=
@repo
.
git
.
cat_file
({
:p
=>
true
},
id
)
def
content
Gitlab
::
Encode
.
utf8
@data
@content
end
end
end
end
Grit
::
Commit
.
class_eval
do
def
message
Gitlab
::
Encode
.
utf8
@message
end
end
Grit
::
Diff
.
class_eval
do
Grit
::
Diff
.
class_eval
do
def
old_path
def
old_path
Gitlab
::
Encode
.
utf8
a_path
Gitlab
::
Encode
.
utf8
@
a_path
end
end
def
new_path
def
new_path
Gitlab
::
Encode
.
utf8
b_path
Gitlab
::
Encode
.
utf8
@
b_path
end
end
end
Grit
::
Git
.
git_timeout
=
GIT_OPTS
[
"git_timeout"
]
def
diff
Grit
::
Git
.
git_max_size
=
GIT_OPTS
[
"git_max_size"
]
Gitlab
::
Encode
.
utf8
@diff
end
end
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