mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-30 22:06:11 +01:00
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: Gabriel Vasile <gabriel.vasile@email.com>
This commit is contained in:
parent
d19c2c9fcb
commit
f7c874cb1a
|
@ -7,12 +7,10 @@ package repository
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"code.gitea.io/gitea/models"
|
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
issues_model "code.gitea.io/gitea/models/issues"
|
issues_model "code.gitea.io/gitea/models/issues"
|
||||||
repo_model "code.gitea.io/gitea/models/repo"
|
repo_model "code.gitea.io/gitea/models/repo"
|
||||||
user_model "code.gitea.io/gitea/models/user"
|
user_model "code.gitea.io/gitea/models/user"
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
"code.gitea.io/gitea/modules/notification"
|
"code.gitea.io/gitea/modules/notification"
|
||||||
repo_module "code.gitea.io/gitea/modules/repository"
|
repo_module "code.gitea.io/gitea/modules/repository"
|
||||||
)
|
)
|
||||||
|
@ -95,11 +93,6 @@ func GenerateRepository(doer, owner *user_model.User, templateRepo *repo_model.R
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}); err != 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
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue