From 685cc358b33e921e2bbcf8b0a3ddd21a5c42e1dd Mon Sep 17 00:00:00 2001 From: Ian Babrou Date: Fri, 9 Sep 2011 17:24:19 +0400 Subject: [PATCH 1/2] forcing encoding to UTF-8 for git tree to be able to use gollum with non-ascii wiki filenames --- lib/gollum/git_access.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/gollum/git_access.rb b/lib/gollum/git_access.rb index 9fe5298e..3df2bc89 100644 --- a/lib/gollum/git_access.rb +++ b/lib/gollum/git_access.rb @@ -158,6 +158,7 @@ module Gollum def tree!(sha) tree = @repo.git.native(:ls_tree, {:r => true, :l => true, :z => true}, sha) + tree.force_encoding("UTF-8") items = tree.split("\0").inject([]) do |memo, line| memo << parse_tree_line(line) end From a337b9ba150b515a0e710be9c214326738ed5f8a Mon Sep 17 00:00:00 2001 From: Ian Babrou Date: Fri, 9 Sep 2011 19:24:27 +0400 Subject: [PATCH 2/2] added method existence checking for UTF-8, thanks to @technoweenie --- lib/gollum/git_access.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/gollum/git_access.rb b/lib/gollum/git_access.rb index 3df2bc89..7e67010b 100644 --- a/lib/gollum/git_access.rb +++ b/lib/gollum/git_access.rb @@ -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