2018-07-25 05:30:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-06-09 07:48:25 -04:00
|
|
|
class MergeRequestDiffFile < ActiveRecord::Base
|
|
|
|
include Gitlab::EncodingHelper
|
2018-05-16 11:46:18 -04:00
|
|
|
include DiffFile
|
2017-06-09 07:48:25 -04:00
|
|
|
|
|
|
|
belongs_to :merge_request_diff
|
|
|
|
|
|
|
|
def utf8_diff
|
|
|
|
return '' if diff.blank?
|
|
|
|
|
|
|
|
encode_utf8(diff) if diff.respond_to?(:encoding)
|
|
|
|
end
|
2017-07-25 12:57:02 -04:00
|
|
|
|
|
|
|
def diff
|
|
|
|
binary? ? super.unpack('m0').first : super
|
|
|
|
end
|
2017-06-09 07:48:25 -04:00
|
|
|
end
|