mirror of
https://gitcode.com/gitea/gitea.git
synced 2025-05-28 13:20:20 +08:00
Move repository model into models/repo (#17933)
* Some refactors related repository model * Move more methods out of repository * Move repository into models/repo * Fix test * Fix test * some improvements * Remove unnecessary function
This commit is contained in:
@ -5,13 +5,13 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
files_service "code.gitea.io/gitea/services/repository/files"
|
||||
)
|
||||
|
||||
func createFileInBranch(user *user_model.User, repo *models.Repository, treePath, branchName, content string) (*api.FileResponse, error) {
|
||||
func createFileInBranch(user *user_model.User, repo *repo_model.Repository, treePath, branchName, content string) (*api.FileResponse, error) {
|
||||
opts := &files_service.UpdateRepoFileOptions{
|
||||
OldBranch: branchName,
|
||||
TreePath: treePath,
|
||||
@ -23,6 +23,6 @@ func createFileInBranch(user *user_model.User, repo *models.Repository, treePath
|
||||
return files_service.CreateOrUpdateRepoFile(repo, user, opts)
|
||||
}
|
||||
|
||||
func createFile(user *user_model.User, repo *models.Repository, treePath string) (*api.FileResponse, error) {
|
||||
func createFile(user *user_model.User, repo *repo_model.Repository, treePath string) (*api.FileResponse, error) {
|
||||
return createFileInBranch(user, repo, treePath, repo.DefaultBranch, "This is a NEW file")
|
||||
}
|
||||
|
Reference in New Issue
Block a user