diff --git a/lib/ohloh_scm/adapters/svn/commits.rb b/lib/ohloh_scm/adapters/svn/commits.rb index 2b08f58e..1ce64079 100644 --- a/lib/ohloh_scm/adapters/svn/commits.rb +++ b/lib/ohloh_scm/adapters/svn/commits.rb @@ -186,7 +186,7 @@ def recurse_files(path=nil, revision=final_token || 'HEAD') files = [] stdout.each_line do |s| - s.chomp! + s.chomp!.force_encoding('UTF-8') files << s if s.length > 0 and s !~ /CVSROOT\// and s[-1..-1] != '/' end files.sort diff --git a/test/unit/svn_commits_test.rb b/test/unit/svn_commits_test.rb index c6758594..6ca727ac 100644 --- a/test/unit/svn_commits_test.rb +++ b/test/unit/svn_commits_test.rb @@ -106,6 +106,19 @@ def test_remove_dupes_add_replace assert_equal 'A', c.diffs.first.action end + def test_remove_dupes_with_sql_acii_encoding + #Note: If there are two files that are identical except for the encoding, ohloh_scm should only keep one. + svn = SvnAdapter.new + diff_1 = OhlohScm::Diff.new(:action => "M", :path => "/FritzBoxDial/FritzBoxDial/formWählbox.vb") + diff_2 = OhlohScm::Diff.new(:action => "A", :path => "/FritzBoxDial/FritzBoxDial/formWählbox.vb") + c = OhlohScm::Commit.new(:diffs => [diff_1 ,diff_2]) + + svn.remove_dupes(c) + puts c.diffs.count + assert_equal 1, c.diffs.size + assert_equal 'A', c.diffs.first.action + end + # Had so many bugs around this case that a test was required def test_deepen_commit_with_nil_diffs with_svn_repository('svn') do |svn|