46cbe54189
directly force_encoding is wrong, must detect the file string's encoding. then force_encoding the string to it's encoding. last convert it to utf-8.
40 lines
527 B
Ruby
40 lines
527 B
Ruby
class Commit
|
|
include Utils::CharEncode
|
|
|
|
attr_accessor :commit
|
|
attr_accessor :head
|
|
|
|
delegate :message,
|
|
:committed_date,
|
|
:parents,
|
|
:sha,
|
|
:date,
|
|
:author,
|
|
:message,
|
|
:diffs,
|
|
:tree,
|
|
:id,
|
|
:to => :commit
|
|
|
|
def initialize(raw_commit, head = nil)
|
|
@commit = raw_commit
|
|
@head = head
|
|
end
|
|
|
|
def safe_message
|
|
encode(message)
|
|
end
|
|
|
|
def created_at
|
|
committed_date
|
|
end
|
|
|
|
def author_email
|
|
encode(author.email)
|
|
end
|
|
|
|
def author_name
|
|
encode(author.name)
|
|
end
|
|
end
|