gitlabhq/config/initializers/3_grit_ext.rb

29 lines
482 B
Ruby
Raw Normal View History

2011-10-20 22:00:00 +03:00
require 'grit'
2012-04-21 01:26:22 +03:00
require 'pygments'
2011-10-20 22:00:00 +03:00
Grit::Git.git_timeout = Gitlab.config.git_timeout
Grit::Git.git_max_size = Gitlab.config.git_max_size
2011-10-20 22:00:00 +03:00
Grit::Blob.class_eval do
include Linguist::BlobHelper
2011-10-24 22:38:03 +03:00
def data
@data ||= @repo.git.cat_file({:p => true}, id)
Gitlab::Encode.utf8 @data
2011-12-30 22:26:13 +08:00
end
2012-04-11 23:03:56 +03:00
end
2011-12-30 22:26:13 +08:00
Grit::Diff.class_eval do
2012-04-11 23:03:56 +03:00
def old_path
Gitlab::Encode.utf8 @a_path
2012-04-11 23:03:56 +03:00
end
2012-04-05 01:51:49 +03:00
2012-04-11 23:03:56 +03:00
def new_path
Gitlab::Encode.utf8 @b_path
2012-04-05 01:51:49 +03:00
end
2011-12-30 22:26:13 +08:00
def diff
Gitlab::Encode.utf8 @diff
end
end