Project

General

Profile

Defect #40948 » 0002-Fix-tests-for-updated-git-repository.patch

Holger Just, 2024-07-13 13:49

View differences:

test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
99 99
      assert_equal false, br_latin_1_path.is_default
100 100
      br_master = brs[4]
101 101
      assert_equal 'master', br_master.to_s
102
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master.revision
102
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master.revision
103 103
      assert_equal br_master.scmid, br_master.revision
104 104
      assert_equal false, br_master.is_default
105 105
      br_master_20120212 = brs[5]
106 106
      assert_equal 'master-20120212', br_master_20120212.to_s
107
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', br_master_20120212.revision
107
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', br_master_20120212.revision
108 108
      assert_equal br_master_20120212.scmid, br_master_20120212.revision
109 109
      assert_equal true, br_master_20120212.is_default
110 110
      br_latin_1 = brs[-2]
......
158 158
      @adapter.revisions('', nil, "master", {}) do |rev|
159 159
        revs1 << rev
160 160
      end
161
      assert_equal 15, revs1.length
162
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[0].identifier
161
      assert_equal 16, revs1.length
162
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[0].identifier
163 163
      assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs1[-1].identifier
164 164

  
165 165
      revs2 = []
......
167 167
                         {:reverse => true}) do |rev|
168 168
        revs2 << rev
169 169
      end
170
      assert_equal 15, revs2.length
171
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier
170
      assert_equal 16, revs2.length
171
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier
172 172
      assert_equal '7234cb2750b63f47bff735edc50a1c0a433c2518', revs2[0].identifier
173 173
    end
174 174

  
......
180 180
                         {:reverse => true}) do |rev|
181 181
        revs1 << rev
182 182
      end
183
      assert_equal 8, revs1.length
183
      assert_equal 9, revs1.length
184 184
      assert_equal 'fba357b886984ee71185ad2065e65fc0417d9b92', revs1[0].identifier
185 185
      assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs1[1].identifier
186 186
      # 4a07fe31b is not a child of 713f49446
187 187
      assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs1[2].identifier
188 188
      # Merged revision
189 189
      assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs1[3].identifier
190
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs1[-1].identifier
190
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs1[-1].identifier
191 191

  
192 192
      revs2 = []
193 193
      @adapter.revisions('',
......
196 196
                         {:reverse => true}) do |rev|
197 197
        revs2 << rev
198 198
      end
199
      assert_equal 7, revs2.length
199
      assert_equal 8, revs2.length
200 200
      assert_equal '7e61ac704deecde634b51e59daa8110435dcb3da', revs2[0].identifier
201 201
      # 4a07fe31b is not a child of fba357b8869
202 202
      assert_equal '4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8', revs2[1].identifier
203 203
      # Merged revision
204 204
      assert_equal '32ae898b720c2f7eec2723d5bdd558b4cb2d3ddf', revs2[2].identifier
205
      assert_equal '83ca5fd546063a3c7dc2e568ba3355661a9e2b2c', revs2[-1].identifier
205
      assert_equal 'b1650eac7c505a6dab9f19858afc9ecb481eccc2', revs2[-1].identifier
206 206
    end
207 207

  
208 208
    def test_revisions_branch_latin_1_path_encoding_all
......
389 389
                         {:reverse => true}) do |rev|
390 390
        revs1 << rev
391 391
      end
392
      assert_equal 15, revs1.length
392
      assert_equal 16, revs1.length
393 393
      assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
394 394
                   revs1[0].identifier
395 395
      assert_nil revs1[0].parents
test/unit/repository_git_test.rb
20 20
require_relative '../test_helper'
21 21

  
22 22
class RepositoryGitTest < ActiveSupport::TestCase
23
  fixtures :projects, :repositories, :enabled_modules, :users, :roles
23
  fixtures :projects, :repositories, :enabled_modules, :users, :roles, :changesets
24 24

  
25 25
  include Redmine::I18n
26 26

  
......
161 161
      assert_equal NUM_REV, @repository.changesets.count
162 162
      extra_info_heads = @repository.extra_info["heads"].dup
163 163
      assert_equal NUM_HEAD, extra_info_heads.size
164
      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
164
      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
165 165
      assert_equal NUM_HEAD - 2, extra_info_heads.size
166 166
      del_revs =
167 167
        [
168
          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
168 169
          "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
169 170
          "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
170 171
          "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
......
177 178
      end
178 179
      @project.reload
179 180
      cs1 = @repository.changesets
180
      assert_equal NUM_REV - 6, cs1.count
181
      assert_equal NUM_REV - del_revs.size, cs1.count
181 182
      extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
182 183
      h = {}
183 184
      h["heads"] = extra_info_heads
......
189 190
      @project.reload
190 191
      assert_equal NUM_REV, @repository.changesets.count
191 192
      assert_equal NUM_HEAD, @repository.extra_info["heads"].size
192
      assert @repository.extra_info["heads"].index("83ca5fd546063a3c7dc2e568ba3355661a9e2b2c")
193
      assert @repository.extra_info["heads"].index("b1650eac7c505a6dab9f19858afc9ecb481eccc2")
193 194
    end
194 195

  
195 196
    def test_fetch_changesets_history_editing
......
199 200
      assert_equal NUM_REV, @repository.changesets.count
200 201
      extra_info_heads = @repository.extra_info["heads"].dup
201 202
      assert_equal NUM_HEAD, extra_info_heads.size
202
      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
203
      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
203 204
      assert_equal NUM_HEAD - 2, extra_info_heads.size
204 205
      del_revs =
205 206
        [
207
          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
206 208
          "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
207 209
          "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
208 210
          "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
......
214 216
        rev.destroy if del_revs.detect {|r| r == rev.scmid.to_s}
215 217
      end
216 218
      @project.reload
217
      assert_equal NUM_REV - 6, @repository.changesets.count
219
      assert_equal NUM_REV - del_revs.size, @repository.changesets.count
218 220

  
219 221
      c = Changeset.new(:repository   => @repository,
220 222
                        :committed_on => Time.now,
......
223 225
                        :comments     => 'test')
224 226
      assert c.save
225 227
      @project.reload
226
      assert_equal NUM_REV - 5, @repository.changesets.count
228
      assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
227 229

  
228 230
      extra_info_heads << "1234abcd5678"
229 231
      h = {}
......
237 239

  
238 240
      @repository.fetch_changesets
239 241
      @project.reload
240
      assert_equal NUM_REV - 5, @repository.changesets.count
242
      assert_equal NUM_REV - del_revs.size + 1, @repository.changesets.count
241 243
      h2 = @repository.extra_info["heads"].dup
242 244
      assert_equal h1, h2
243 245
    end
......
312 314
      assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
313 315

  
314 316
      extra_info_heads = @repository.extra_info["heads"].dup
315
      extra_info_heads.delete_if {|x| x == "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c"}
317
      extra_info_heads.delete_if {|x| x == "b1650eac7c505a6dab9f19858afc9ecb481eccc2"}
316 318
      del_revs =
317 319
        [
320
          "b1650eac7c505a6dab9f19858afc9ecb481eccc2",
318 321
          "83ca5fd546063a3c7dc2e568ba3355661a9e2b2c",
319 322
          "ed5bb786bbda2dee66a2d50faf51429dbc043a7b",
320 323
          "4f26664364207fa8b1af9f8722647ab2d4ac5d43",
......
327 330
      end
328 331
      @project.reload
329 332
      cs1 = @repository.changesets
330
      assert_equal NUM_REV - 6, cs1.count
333
      assert_equal NUM_REV - del_revs.size, cs1.count
331 334
      assert_equal 0, @repository.extra_info["db_consistent"]["ordering"]
332 335

  
333 336
      extra_info_heads << "4a07fe31bffcf2888791f3e6cbc9c4545cefe3e8"
(4-4/5)