Commit e1d1673e authored by Saito's avatar Saito
Browse files

monkey patch grit to support utf8 encoding

parent e4de518c5186
require 'grit'
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
include Linguist::BlobHelper
end
#monkey patch raw_object from string
Grit::GitRuby::Internal::RawObject.class_eval do
def content
@content
def data
@data ||= @repo.git.cat_file({:p => true}, id)
Gitlab::Encode.utf8 @data
end
end
Grit::Commit.class_eval do
def message
Gitlab::Encode.utf8 @message
end
end
Grit::Diff.class_eval do
def old_path
Gitlab::Encode.utf8 a_path
Gitlab::Encode.utf8 @a_path
end
def new_path
Gitlab::Encode.utf8 b_path
Gitlab::Encode.utf8 @b_path
end
end
Grit::Git.git_timeout = GIT_OPTS["git_timeout"]
Grit::Git.git_max_size = GIT_OPTS["git_max_size"]
def diff
Gitlab::Encode.utf8 @diff
end
end
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