gitlabhq/config/initializers/3_grit_ext.rb

29 lines
482 B
Ruby
Raw Normal View History

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