mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 00:10:15 +00:00
Move create/fork repository from models to modules/repository (#9489)
* Move create/fork repository from models to modules/repository * fix wrong reference * fix test * fix test * fix lint * Fix DBContext * remove duplicated TestMain * fix lint * fix conflicts
This commit is contained in:
parent
5765212c6d
commit
b465d0d787
22 changed files with 894 additions and 794 deletions
|
@ -8,20 +8,21 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
)
|
||||
|
||||
// GenerateRepository generates a repository from a template
|
||||
func GenerateRepository(doer, owner *models.User, templateRepo *models.Repository, opts models.GenerateRepoOptions) (_ *models.Repository, err error) {
|
||||
var generateRepo *models.Repository
|
||||
if err = models.WithTx(func(ctx models.DBContext) error {
|
||||
generateRepo, err = models.GenerateRepository(ctx, doer, owner, templateRepo, opts)
|
||||
generateRepo, err = repo_module.GenerateRepository(ctx, doer, owner, templateRepo, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Git Content
|
||||
if opts.GitContent && !templateRepo.IsEmpty {
|
||||
if err = models.GenerateGitContent(ctx, templateRepo, generateRepo); err != nil {
|
||||
if err = repo_module.GenerateGitContent(ctx, templateRepo, generateRepo); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue