Skip to content

Commit

Permalink
Remove manual rollback for failed generated repositories (go-gitea#20639
Browse files Browse the repository at this point in the history
)

Generating repositories from a template is done inside a transaction.
Manual rollback on error is not needed and it always results in error
"repository does not exist".

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
  • Loading branch information
2 people authored and Sysoev, Vladimir committed Aug 10, 2022
1 parent 381ba48 commit a4e52ec
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions services/repository/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ package repository
import (
"context"

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
issues_model "code.gitea.io/gitea/models/issues"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/notification"
repo_module "code.gitea.io/gitea/modules/repository"
)
Expand Down Expand Up @@ -100,11 +98,6 @@ func GenerateRepository(doer, owner *user_model.User, templateRepo *repo_model.R

return nil
}); err != nil {
if generateRepo != nil && generateRepo.ID > 0 {
if errDelete := models.DeleteRepository(doer, owner.ID, generateRepo.ID); errDelete != nil {
log.Error("Rollback deleteRepository: %v", errDelete)
}
}
return nil, err
}

Expand Down

0 comments on commit a4e52ec

Please sign in to comment.