aboutsummaryrefslogtreecommitdiffstats
path: root/services/repository/files/update.go
diff options
context:
space:
mode:
Diffstat (limited to 'services/repository/files/update.go')
-rw-r--r--services/repository/files/update.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/services/repository/files/update.go b/services/repository/files/update.go
index a093ee5da7..4615a9153a 100644
--- a/services/repository/files/update.go
+++ b/services/repository/files/update.go
@@ -13,6 +13,7 @@ import (
"time"
"code.gitea.io/gitea/models"
+ git_model "code.gitea.io/gitea/models/git"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/charset"
@@ -75,8 +76,8 @@ func detectEncodingAndBOM(entry *git.TreeEntry, repo *repo_model.Repository) (st
if setting.LFS.StartServer {
pointer, _ := lfs.ReadPointerFromBuffer(buf)
if pointer.IsValid() {
- meta, err := models.GetLFSMetaObjectByOid(repo.ID, pointer.Oid)
- if err != nil && err != models.ErrLFSObjectNotExist {
+ meta, err := git_model.GetLFSMetaObjectByOid(repo.ID, pointer.Oid)
+ if err != nil && err != git_model.ErrLFSObjectNotExist {
// return default
return "UTF-8", false
}
@@ -364,7 +365,7 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
}
// Reset the opts.Content to our adjusted content to ensure that LFS gets the correct content
opts.Content = content
- var lfsMetaObject *models.LFSMetaObject
+ var lfsMetaObject *git_model.LFSMetaObject
if setting.LFS.StartServer && hasOldBranch {
// Check there is no way this can return multiple infos
@@ -383,7 +384,7 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
if err != nil {
return nil, err
}
- lfsMetaObject = &models.LFSMetaObject{Pointer: pointer, RepositoryID: repo.ID}
+ lfsMetaObject = &git_model.LFSMetaObject{Pointer: pointer, RepositoryID: repo.ID}
content = pointer.StringContent()
}
}
@@ -423,7 +424,7 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
if lfsMetaObject != nil {
// We have an LFS object - create it
- lfsMetaObject, err = models.NewLFSMetaObject(lfsMetaObject)
+ lfsMetaObject, err = git_model.NewLFSMetaObject(lfsMetaObject)
if err != nil {
return nil, err
}
@@ -434,7 +435,7 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
}
if !exist {
if err := contentStore.Put(lfsMetaObject.Pointer, strings.NewReader(opts.Content)); err != nil {
- if _, err2 := models.RemoveLFSMetaObjectByOid(repo.ID, lfsMetaObject.Oid); err2 != nil {
+ if _, err2 := git_model.RemoveLFSMetaObjectByOid(repo.ID, lfsMetaObject.Oid); err2 != nil {
return nil, fmt.Errorf("Error whilst removing failed inserted LFS object %s: %v (Prev Error: %v)", lfsMetaObject.Oid, err2, err)
}
return nil, err
@@ -462,7 +463,7 @@ func CreateOrUpdateRepoFile(ctx context.Context, repo *repo_model.Repository, do
// VerifyBranchProtection verify the branch protection for modifying the given treePath on the given branch
func VerifyBranchProtection(ctx context.Context, repo *repo_model.Repository, doer *user_model.User, branchName, treePath string) error {
- protectedBranch, err := models.GetProtectedBranchBy(ctx, repo.ID, branchName)
+ protectedBranch, err := git_model.GetProtectedBranchBy(ctx, repo.ID, branchName)
if err != nil {
return err
}