summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/redmine/scm/adapters/git_adapter.rb2
-rw-r--r--test/unit/lib/redmine/scm/adapters/git_adapter_test.rb13
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb
index 1876190d9..3c9758a2e 100644
--- a/lib/redmine/scm/adapters/git_adapter.rb
+++ b/lib/redmine/scm/adapters/git_adapter.rb
@@ -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
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 7155bed4f..9a057331a 100644
--- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
@@ -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})