Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing encoding in commit messages

  • Loading branch information...
commit 2c3085eb8a3738ba5cfc881f0c494f91e9e7d27d 1 parent e4c5616
@runemadsen runemadsen authored
Showing with 8 additions and 1 deletion.
  1. +4 −0 TODO.txt
  2. +4 −1 lib/git-api/helpers.rb
View
4 TODO.txt
@@ -1,3 +1,7 @@
+# TODO NOW
+# Use linguist to check if diff or content is binary. If it is, don't show it
+
+
# TODO
# When posting a file to a new branch and not specifying from_branch, then commits to that new branch equal 0 and not 1.
# Use repo.lstree when getting contents of a tree - faster and easier to get recursive contents (if we don't need data in blobs)
View
5 lib/git-api/helpers.rb
@@ -88,7 +88,7 @@ def commit_baked_to_hash(commit)
:id => commit.id,
:parents => commit.parents.map { |p| { 'id' => p.id } },
:tree => commit.tree.id,
- :message => commit.message,
+ :message => iconv_utf8(commit.message),
:author => {
:name => commit.author.name,
:email => commit.author.email
@@ -120,6 +120,9 @@ def diff_to_hash(diff)
}
end
+ # Because grit has not encoded its strings, all strings come out as binary. This function converts
+ # the binary string to utf-8.
+
def iconv_utf8(s)
Iconv.new('UTF-8//IGNORE', 'US-ASCII').iconv(s + ' ')[0..-2]
end
Please sign in to comment.
Something went wrong with that request. Please try again.