提交 e1d1673e 编写于 作者: S Saito

monkey patch grit to support utf8 encoding

上级 206230a4
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册