]> source.dussan.org Git - redmine.git/commitdiff
scm: git: use --encoding=UTF-8 in "git log" (#3396).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 28 Feb 2011 14:12:47 +0000 (14:12 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 28 Feb 2011 14:12:47 +0000 (14:12 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4964 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/repository/git.rb
lib/redmine/scm/adapters/git_adapter.rb
test/fixtures/repositories/git_repository.tar.gz
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
test/unit/repository_git_test.rb

index 0ebd8668e0adc2d463ac1425749a4bb4dc873b28..63faea668713168fb63674a226f69aa7c87165bb 100644 (file)
@@ -29,6 +29,10 @@ class Repository::Git < Repository
     'Git'
   end
 
+  def repo_log_encoding
+    'UTF-8'
+  end
+
   # Returns the identifier for the given git changeset
   def self.changeset_identifier(changeset)
     changeset.scmid
index 4d3ea598fe6b1ae07a76463b9896b2d000115c9b..6ad7426c3729b1dd4584d37b291ad98e2c8b6b68 100644 (file)
@@ -129,7 +129,7 @@ module Redmine
 
         def lastrev(path, rev)
           return nil if path.nil?
-          cmd_args = %w|log --no-color --date=iso --pretty=fuller --no-merges -n 1|
+          cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1|
           cmd_args << rev if rev 
           cmd_args << "--" << path unless path.empty?
           lines = []
@@ -157,7 +157,7 @@ module Redmine
 
         def revisions(path, identifier_from, identifier_to, options={})
           revisions = Revisions.new
-          cmd_args = %w|log --no-color --raw --date=iso --pretty=fuller|
+          cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller|
           cmd_args << "--reverse" if options[:reverse]
           cmd_args << "--all" if options[:all]
           cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
index 58b4df5fdb0c97b8a3f06b48f44eb33032cd3899..48c8027c86c7f9850658aadfff118e0102557f22 100644 (file)
Binary files a/test/fixtures/repositories/git_repository.tar.gz and b/test/fixtures/repositories/git_repository.tar.gz differ
index d86b120d4e26c539cdddd4baf4888b44567bcc22..ba8d3f69cf257f60c4e3b57d9b62be9eb44b7e53 100644 (file)
@@ -28,11 +28,11 @@ begin
       end
 
       def test_branches
-        assert_equal @adapter.branches, ['master', 'test_branch']
+        assert_equal @adapter.branches, ['master', 'test-latin-1', 'test_branch']
       end
 
       def test_getting_all_revisions
-        assert_equal 15, @adapter.revisions('',nil,nil,:all => true).length
+        assert_equal 16, @adapter.revisions('',nil,nil,:all => true).length
       end
 
       def test_getting_certain_revisions
index 46d1ad6bb52d2aee555c4bdb09be90c4e4c365be..baa1764140b2ef14c5a2e5dafc275c33c8ee3223 100644 (file)
@@ -38,8 +38,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
       @repository.fetch_changesets
       @repository.reload
 
-      assert_equal 15, @repository.changesets.count
-      assert_equal 24, @repository.changes.count
+      assert_equal 16, @repository.changesets.count
+      assert_equal 25, @repository.changes.count
 
       commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
       assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
@@ -61,10 +61,10 @@ class RepositoryGitTest < ActiveSupport::TestCase
       # Remove the 3 latest changesets
       @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy)
       @repository.reload
-      assert_equal 12, @repository.changesets.count
+      assert_equal 13, @repository.changesets.count
       
       @repository.fetch_changesets
-      assert_equal 15, @repository.changesets.count
+      assert_equal 16, @repository.changesets.count
     end
 
     def test_find_changeset_by_name