]> source.dussan.org Git - redmine.git/commitdiff
Merged r22910, r22924, r22928 and r22929 from trunk to 5.1-stable (#40948).
authorMarius Balteanu <marius.balteanu@zitec.com>
Sat, 20 Jul 2024 09:46:16 +0000 (09:46 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sat, 20 Jul 2024 09:46:16 +0000 (09:46 +0000)
git-svn-id: https://svn.redmine.org/redmine/branches/5.1-stable@22940 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index 9637702abd02558102bbaeb486cd0f0dd2ab16e7..b6b3c8336c894df2199e03cad21f49889f00b586 100644 (file)
@@ -219,7 +219,7 @@ class Repository::Git < Repository
         :repository   => self,
         :revision     => rev.identifier,
         :scmid        => rev.scmid,
-        :committer    => rev.author,
+        :committer    => rev.author.truncate(255),
         :committed_on => rev.time,
         :comments     => rev.message,
         :parents      => parents
index 0ea93071f1518062464dbaebc4d7f94f09557e99..f31979845863f0c45fb86fee3517bbe896554901 100644 (file)
Binary files a/test/fixtures/repositories/git_repository.tar.gz and b/test/fixtures/repositories/git_repository.tar.gz differ
index d20918d5a829e4a49dd0b99ff0fb43219eabfb66..181787af47f5c775ea374fd70a3394f76a1b70cc 100644 (file)
@@ -28,7 +28,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest
   REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
   REPOSITORY_PATH.tr!('/', "\\") if Redmine::Platform.mswin?
   PRJ_ID     = 3
-  NUM_REV = 28
+  NUM_REV = 29
 
   def setup
     super
index 67c61575ca71da396ac7b97117c3bc8135cd9db6..8a33c356e9c8759e346dd9e0e51850ab735310ee 100644 (file)
@@ -26,7 +26,7 @@ class RepositoriesGitTest < Redmine::IntegrationTest
   REPOSITORY_PATH = Rails.root.join('tmp/test/git_repository').to_s
   REPOSITORY_PATH.tr!('/', "\\") if Redmine::Platform.mswin?
   PRJ_ID     = 3
-  NUM_REV = 28
+  NUM_REV = 29
 
   def setup
     User.current = nil
index 6ea41e75e22e74e949c2c3a714cc3bac399d0b08..b7a95b635acd4ef13d771759460f81dcdfce7656 100644 (file)
@@ -102,12 +102,12 @@ class GitAdapterTest < ActiveSupport::TestCase
       assert_equal false, br_latin_1_path.is_default
       br_master = brs[4]
       assert_equal 'master', br_master.to_s
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master.revision
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master.revision
       assert_equal br_master.scmid, br_master.revision
       assert_equal false, br_master.is_default
       br_master_20120212 = brs[5]
       assert_equal 'master-20120212', br_master_20120212.to_s
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master_20120212.revision
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master_20120212.revision
       assert_equal br_master_20120212.scmid, br_master_20120212.revision
       assert_equal true, br_master_20120212.is_default
       br_latin_1 = brs[-2]
@@ -161,8 +161,8 @@ class GitAdapterTest < ActiveSupport::TestCase
       @adapter.revisions('', nil, "master", {}) do |rev|
         revs1 << rev
       end
-      assert_equal 15, revs1.length
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[0].identifier
+      assert_equal 16, revs1.length
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[0].identifier
       assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[-1].identifier
 
       revs2 = []
@@ -170,8 +170,8 @@ class GitAdapterTest < ActiveSupport::TestCase
                          {:reverse => true}) do |rev|
         revs2 << rev
       end
-      assert_equal 15, revs2.length
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier
+      assert_equal 16, revs2.length
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier
       assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs2[0].identifier
     end
 
@@ -183,14 +183,14 @@ class GitAdapterTest < ActiveSupport::TestCase
                          {:reverse => true}) do |rev|
         revs1 << rev
       end
-      assert_equal 8, revs1.length
+      assert_equal 9, revs1.length
       assert_equal 'fba357b886984ee71185ad2065e65fc0417d9b92', revs1[0].identifier
       assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs1[1].identifier
       # 4a07fe31b is not a child of 713f49446
       assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs1[2].identifier
       # Merged revision
       assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs1[3].identifier
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[-1].identifier
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[-1].identifier
 
       revs2 = []
       @adapter.revisions('',
@@ -199,13 +199,13 @@ class GitAdapterTest < ActiveSupport::TestCase
                          {:reverse => true}) do |rev|
         revs2 << rev
       end
-      assert_equal 7, revs2.length
+      assert_equal 8, revs2.length
       assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs2[0].identifier
       # 4a07fe31b is not a child of fba357b8869
       assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs2[1].identifier
       # Merged revision
       assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs2[2].identifier
-      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier
+      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier
     end
 
     def test_revisions_branch_latin_1_path_encoding_all
@@ -392,7 +392,7 @@ class GitAdapterTest < ActiveSupport::TestCase
                          {:reverse => true}) do |rev|
         revs1 << rev
       end
-      assert_equal 15, revs1.length
+      assert_equal 16, revs1.length
       assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
                    revs1[0].identifier
       assert_nil revs1[0].parents
index 7f848c043e9b11d91bb0624fa93ebfc5eb5a0a41..921628a9d4259c1593964d785e1c0855baa69d1d 100644 (file)
@@ -20,7 +20,7 @@
 require_relative '../test_helper'
 
 class RepositoryGitTest < ActiveSupport::TestCase
-  fixtures :projects, :repositories, :enabled_modules, :users, :roles
+  fixtures :projects, :repositories, :enabled_modules, :users, :roles, :changesets
 
   include Redmine::I18n
 
@@ -30,7 +30,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
   REPOSITORY_UTF8_PATH = Rails.root.join('tmp/test/git_utf8_repository').to_s
   REPOSITORY_UTF8_PATH.tr!('/', "\\") if Redmine::Platform.mswin?
 
-  NUM_REV = 28
+  NUM_REV = 29
   NUM_HEAD = 8
 
   def setup
@@ -135,7 +135,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
       @project.reload
 
       assert_equal NUM_REV, @repository.changesets.count
-      assert_equal 39, @repository.filechanges.count
+      assert_equal 40, @repository.filechanges.count
 
       commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
       assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
@@ -161,10 +161,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
       assert_equal NUM_REV, @repository.changesets.count
       extra_info_heads = @repository.extra_info["heads"].dup
       assert_equal NUM_HEAD, extra_info_heads.size
-      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
+      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
       assert_equal NUM_HEAD - 2, extra_info_heads.size
       del_revs =
         [
+          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
           "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
           "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
           "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
@@ -177,7 +178,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
       end
       @project.reload
       cs1 = @repository.changesets
-      assert_equal NUM_REV - 6, cs1.count
+      assert_equal NUM_REV - del_revs.size, cs1.count
       extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
       h = {}
       h["heads"] = extra_info_heads
@@ -189,7 +190,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
       @project.reload
       assert_equal NUM_REV, @repository.changesets.count
       assert_equal NUM_HEAD, @repository.extra_info["heads"].size
-      assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
+      assert @repository.extra_info["heads"].index("b1650eac7c505a6dab9f19858afc9ecb481eccc2")
     end
 
     def test_fetch_changesets_history_editing
@@ -199,10 +200,11 @@ class RepositoryGitTest < ActiveSupport::TestCase
       assert_equal NUM_REV, @repository.changesets.count
       extra_info_heads = @repository.extra_info["heads"].dup
       assert_equal NUM_HEAD, extra_info_heads.size
-      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
+      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
       assert_equal NUM_HEAD - 2, extra_info_heads.size
       del_revs =
         [
+          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
           "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
           "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
           "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
@@ -214,7 +216,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
         rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s}
       end
       @project.reload
-      assert_equal NUM_REV - 6, @repository.changesets.count
+      assert_equal NUM_REV - del_revs.size, @repository.changesets.count
 
       c = Changeset.new(:repository   => @repository,
                         :committed_on => Time.now,
@@ -223,7 +225,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
                         :comments     => 'test')
       assert c.save
       @project.reload
-      assert_equal NUM_REV - 5, @repository.changesets.count
+      assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
 
       extra_info_heads << "1234abcd5678"
       h = {}
@@ -237,7 +239,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
 
       @repository.fetch_changesets
       @project.reload
-      assert_equal NUM_REV - 5, @repository.changesets.count
+      assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
       h2 = @repository.extra_info["heads"].dup
       assert_equal h1, h2
     end
@@ -312,9 +314,10 @@ class RepositoryGitTest < ActiveSupport::TestCase
       assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
 
       extra_info_heads = @repository.extra_info["heads"].dup
-      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
+      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
       del_revs =
         [
+          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
           "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
           "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
           "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
@@ -327,7 +330,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
       end
       @project.reload
       cs1 = @repository.changesets
-      assert_equal NUM_REV - 6, cs1.count
+      assert_equal NUM_REV - del_revs.size, cs1.count
       assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
 
       extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"