##// END OF EJS Templates
scm: git: use --encoding=UTF-8 in "git log" (#3396)....
Toshi MARUYAMA -
r4844:eb1271bb444c
parent child
Show More
@@ -29,6 +29,10 class Repository::Git < Repository
29 'Git'
29 'Git'
30 end
30 end
31
31
32 def repo_log_encoding
33 'UTF-8'
34 end
35
32 # Returns the identifier for the given git changeset
36 # Returns the identifier for the given git changeset
33 def self.changeset_identifier(changeset)
37 def self.changeset_identifier(changeset)
34 changeset.scmid
38 changeset.scmid
@@ -129,7 +129,7 module Redmine
129
129
130 def lastrev(path, rev)
130 def lastrev(path, rev)
131 return nil if path.nil?
131 return nil if path.nil?
132 cmd_args = %w|log --no-color --date=iso --pretty=fuller --no-merges -n 1|
132 cmd_args = %w|log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1|
133 cmd_args << rev if rev
133 cmd_args << rev if rev
134 cmd_args << "--" << path unless path.empty?
134 cmd_args << "--" << path unless path.empty?
135 lines = []
135 lines = []
@@ -157,7 +157,7 module Redmine
157
157
158 def revisions(path, identifier_from, identifier_to, options={})
158 def revisions(path, identifier_from, identifier_to, options={})
159 revisions = Revisions.new
159 revisions = Revisions.new
160 cmd_args = %w|log --no-color --raw --date=iso --pretty=fuller|
160 cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller|
161 cmd_args << "--reverse" if options[:reverse]
161 cmd_args << "--reverse" if options[:reverse]
162 cmd_args << "--all" if options[:all]
162 cmd_args << "--all" if options[:all]
163 cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
163 cmd_args << "-n" << "#{options[:limit].to_i}" if options[:limit]
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -28,11 +28,11 begin
28 end
28 end
29
29
30 def test_branches
30 def test_branches
31 assert_equal @adapter.branches, ['master', 'test_branch']
31 assert_equal @adapter.branches, ['master', 'test-latin-1', 'test_branch']
32 end
32 end
33
33
34 def test_getting_all_revisions
34 def test_getting_all_revisions
35 assert_equal 15, @adapter.revisions('',nil,nil,:all => true).length
35 assert_equal 16, @adapter.revisions('',nil,nil,:all => true).length
36 end
36 end
37
37
38 def test_getting_certain_revisions
38 def test_getting_certain_revisions
@@ -38,8 +38,8 class RepositoryGitTest < ActiveSupport::TestCase
38 @repository.fetch_changesets
38 @repository.fetch_changesets
39 @repository.reload
39 @repository.reload
40
40
41 assert_equal 15, @repository.changesets.count
41 assert_equal 16, @repository.changesets.count
42 assert_equal 24, @repository.changes.count
42 assert_equal 25, @repository.changes.count
43
43
44 commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
44 commit = @repository.changesets.find(:first, :order => 'committed_on ASC')
45 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
45 assert_equal "Initial import.\nThe repository contains 3 files.", commit.comments
@@ -61,10 +61,10 class RepositoryGitTest < ActiveSupport::TestCase
61 # Remove the 3 latest changesets
61 # Remove the 3 latest changesets
62 @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy)
62 @repository.changesets.find(:all, :order => 'committed_on DESC', :limit => 3).each(&:destroy)
63 @repository.reload
63 @repository.reload
64 assert_equal 12, @repository.changesets.count
64 assert_equal 13, @repository.changesets.count
65
65
66 @repository.fetch_changesets
66 @repository.fetch_changesets
67 assert_equal 15, @repository.changesets.count
67 assert_equal 16, @repository.changesets.count
68 end
68 end
69
69
70 def test_find_changeset_by_name
70 def test_find_changeset_by_name
General Comments 0
You need to be logged in to leave comments. Login now