summaryrefslogtreecommitdiff
path: root/lib/commit_ext.rb
blob: 6606ee46b492fccf1dd4f7cd94a049a73db55ddd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module CommitExt
  
  attr_accessor :refs

  def safe_message
    message.encode("UTF-8",
                   :invalid => :replace,
                   :undef => :replace,
                   :universal_newline => true,
                   :replace => "")
  rescue
    "-- invalid encoding for commit message"
  end

  def created_at
    committed_date
  end

  def author_email
    author.email.force_encoding(Encoding::UTF_8)
  end

  def author_name
    author.name.force_encoding(Encoding::UTF_8)
  end
end