]> source.dussan.org Git - redmine.git/commitdiff
Merged r12143 from trunk to 2.3-stable (#14931)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 19 Sep 2013 03:25:38 +0000 (03:25 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 19 Sep 2013 03:25:38 +0000 (03:25 +0000)
scm: git: use "--encoding=UTF-8" for blame.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/2.3-stable@12159 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/git_adapter.rb
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb

index 1876190d974ee6de87996e9abb0700517b132ac8..3c9758a2e3d175932934796c9ea1508cff340523 100644 (file)
@@ -333,7 +333,7 @@ module Redmine
 
         def annotate(path, identifier=nil)
           identifier = 'HEAD' if identifier.blank?
-          cmd_args = %w|blame|
+          cmd_args = %w|blame --encoding=UTF-8|
           cmd_args << "-p" << identifier << "--" <<  scm_iconv(@path_encoding, 'UTF-8', path)
           blame = Annotate.new
           content = nil
index 00837e7b7d220fa7f674e49d681dc57a6b0ea62e..6fabf4d8e4f6ea6a4fa425b277e4e6cedb0a2c1c 100644 (file)
@@ -424,6 +424,19 @@ begin
         end
       end
 
+      def test_latin_1_user_annotate
+        ['83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', '83ca5fd546063a'].each do |r1|
+          annotate = @adapter.annotate(" filename with a leading space.txt ", r1)
+          assert_kind_of Redmine::Scm::Adapters::Annotate, annotate
+          assert_equal 1, annotate.lines.size
+          assert_equal "And this is a file with a leading and trailing space...",
+                       annotate.lines[0].strip
+          assert_equal "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
+                       annotate.revisions[0].identifier
+          assert_equal @str_felix_hex, annotate.revisions[0].author
+        end
+      end
+
       def test_entries_tag
         entries1 = @adapter.entries(nil, 'tag01.annotated',
                                     options = {:report_last_commit => true})