added method existence checking for UTF-8, thanks to @technoweenie

This commit is contained in:
Ian Babrou
2011-09-09 19:24:27 +04:00
parent 685cc358b3
commit a337b9ba15
+3 -1
View File
@@ -158,7 +158,9 @@ module Gollum
def tree!(sha)
tree = @repo.git.native(:ls_tree,
{:r => true, :l => true, :z => true}, sha)
tree.force_encoding("UTF-8")
if tree.respond_to?(:force_encoding)
tree.force_encoding("UTF-8")
end
items = tree.split("\0").inject([]) do |memo, line|
memo << parse_tree_line(line)
end