mirror of
				https://github.com/go-gitea/gitea
				synced 2025-11-03 21:08:25 +00:00 
			
		
		
		
	Allow adding new files to an empty repo (#24164)

This commit is contained in:
		@@ -19,13 +19,16 @@ func TestIterate(t *testing.T) {
 | 
			
		||||
	xe := unittest.GetXORMEngine()
 | 
			
		||||
	assert.NoError(t, xe.Sync(&repo_model.RepoUnit{}))
 | 
			
		||||
 | 
			
		||||
	var repoCnt int
 | 
			
		||||
	err := db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repo *repo_model.RepoUnit) error {
 | 
			
		||||
		repoCnt++
 | 
			
		||||
	cnt, err := db.GetEngine(db.DefaultContext).Count(&repo_model.RepoUnit{})
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	var repoUnitCnt int
 | 
			
		||||
	err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repo *repo_model.RepoUnit) error {
 | 
			
		||||
		repoUnitCnt++
 | 
			
		||||
		return nil
 | 
			
		||||
	})
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	assert.EqualValues(t, 89, repoCnt)
 | 
			
		||||
	assert.EqualValues(t, cnt, repoUnitCnt)
 | 
			
		||||
 | 
			
		||||
	err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repoUnit *repo_model.RepoUnit) error {
 | 
			
		||||
		reopUnit2 := repo_model.RepoUnit{ID: repoUnit.ID}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user