diff options
author | Saito <saitowu@gmail.com> | 2011-11-28 17:46:41 +0800 |
---|---|---|
committer | Saito <saitowu@gmail.com> | 2011-11-28 17:46:41 +0800 |
commit | 46cbe5418947ab58c919432b9013252ada6a3bc3 (patch) | |
tree | 1c2ae343e97d0fa93f7c8e1ded4ab64f04ce6233 /lib/graph_commit.rb | |
parent | 75fa0632e67b2b91401673b0dd292db4103224c8 (diff) | |
download | gitlab-ce-46cbe5418947ab58c919432b9013252ada6a3bc3.tar.gz |
fix the issue on github #157.
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.
Diffstat (limited to 'lib/graph_commit.rb')
-rw-r--r-- | lib/graph_commit.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/graph_commit.rb b/lib/graph_commit.rb index 18b1702250c..1fcb9e78ef0 100644 --- a/lib/graph_commit.rb +++ b/lib/graph_commit.rb @@ -1,6 +1,7 @@ require "grit" class GraphCommit + include Utils::CharEncode attr_accessor :time, :space attr_accessor :refs @@ -65,7 +66,7 @@ class GraphCommit # @param [GraphCommit] the commit object. # @param [Hash<String,GraphCommit>] map of commits # - # @return [Fixnum] max space used. + # @return [Fixnum] max space used. def self.mark_chain(mark, commit, map) commit.space = mark if commit.space == 0 m1 = mark - 1 @@ -96,13 +97,13 @@ class GraphCommit h[:parents] = self.parents.collect do |p| [p.id,0,0] end - h[:author] = author.name.force_encoding("UTF-8") + h[:author] = encode(author.name) h[:time] = time h[:space] = space h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil? h[:id] = sha h[:date] = date - h[:message] = message.force_encoding("UTF-8") + h[:message] = encode(message) h[:login] = author.email h end |