From 123d2b318f18b6115ff1225dd9017add51c7f234 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 28 Oct 2012 07:12:23 +0000 Subject: [PATCH] fix scm_iconv local variable name (#12228) git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10741 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/abstract_adapter.rb | 2 +- .../redmine/scm/adapters/git_adapter_test.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index c15965595..28f5f16f8 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -264,7 +264,7 @@ module Redmine str.force_encoding(from) begin s = str.encode(to) - rescue Exception => e + rescue Exception => err logger.error("failed to convert from #{from} to #{to}. #{err}") nil end diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb index 028701c17..e1fbf3b74 100644 --- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb +++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb @@ -460,6 +460,23 @@ begin assert_equal Time.gm(2009, 6, 19, 4, 37, 23), readme.lastrev.time end + def test_entries_wrong_path_encoding + adpt = Redmine::Scm::Adapters::GitAdapter.new( + REPOSITORY_PATH, + nil, + nil, + nil, + 'EUC-JP' + ) + entries1 = adpt.entries('latin-1-dir', '64f1f3e8') + assert entries1 + assert_equal 3, entries1.size + f1 = entries1[1] + assert_equal nil, f1.name + assert_equal nil, f1.path + assert_equal 'file', f1.kind + end + def test_entries_latin_1_files entries1 = @adapter.entries('latin-1-dir', '64f1f3e8') assert entries1