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
|
|
|
|
2012-07-02 21:51:48 +03:00
|
|
|
Grit::Git.git_timeout = Gitlab.config.git_timeout
|
|
|
|
Grit::Git.git_max_size = Gitlab.config.git_max_size
|
2012-05-29 16:17:31 +08:00
|
|
|
|
2011-10-20 22:00:00 +03:00
|
|
|
Grit::Blob.class_eval do
|
2012-04-20 23:21:12 +02:00
|
|
|
include Linguist::BlobHelper
|
2011-10-24 22:38:03 +03:00
|
|
|
|
2012-05-29 16:17:31 +08: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
|
|
|
|
2012-04-20 23:21:12 +02:00
|
|
|
Grit::Diff.class_eval do
|
2012-04-11 23:03:56 +03:00
|
|
|
def old_path
|
2012-05-29 16:17:31 +08:00
|
|
|
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
|
2012-05-29 16:17:31 +08:00
|
|
|
Gitlab::Encode.utf8 @b_path
|
2012-04-05 01:51:49 +03:00
|
|
|
end
|
2011-12-30 22:26:13 +08:00
|
|
|
|
2012-05-29 16:17:31 +08:00
|
|
|
def diff
|
|
|
|
Gitlab::Encode.utf8 @diff
|
|
|
|
end
|
|
|
|
end
|