diff options
Diffstat (limited to 'services/repository/files/upload.go')
-rw-r--r-- | services/repository/files/upload.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/services/repository/files/upload.go b/services/repository/files/upload.go index ff0448fc87..ffc1f4efe9 100644 --- a/services/repository/files/upload.go +++ b/services/repository/files/upload.go @@ -12,6 +12,7 @@ import ( "strings" "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/git" @@ -32,7 +33,7 @@ type UploadRepoFileOptions struct { type uploadInfo struct { upload *models.Upload - lfsMetaObject *models.LFSMetaObject + lfsMetaObject *git_model.LFSMetaObject } func cleanUpAfterFailure(infos *[]uploadInfo, t *TemporaryUploadRepository, original error) error { @@ -41,7 +42,7 @@ func cleanUpAfterFailure(infos *[]uploadInfo, t *TemporaryUploadRepository, orig continue } if !info.lfsMetaObject.Existing { - if _, err := models.RemoveLFSMetaObjectByOid(t.repo.ID, info.lfsMetaObject.Oid); err != nil { + if _, err := git_model.RemoveLFSMetaObjectByOid(t.repo.ID, info.lfsMetaObject.Oid); err != nil { original = fmt.Errorf("%v, %v", original, err) } } @@ -65,7 +66,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use for i, upload := range uploads { // Check file is not lfs locked, will return nil if lock setting not enabled filepath := path.Join(opts.TreePath, upload.Name) - lfsLock, err := models.GetTreePathLock(repo.ID, filepath) + lfsLock, err := git_model.GetTreePathLock(repo.ID, filepath) if err != nil { return err } @@ -74,7 +75,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use if err != nil { return err } - return models.ErrLFSFileLocked{RepoID: repo.ID, Path: filepath, UserName: u.Name} + return git_model.ErrLFSFileLocked{RepoID: repo.ID, Path: filepath, UserName: u.Name} } names[i] = upload.Name @@ -133,7 +134,7 @@ func UploadRepoFiles(ctx context.Context, repo *repo_model.Repository, doer *use if infos[i].lfsMetaObject == nil { continue } - infos[i].lfsMetaObject, err = models.NewLFSMetaObject(infos[i].lfsMetaObject) + infos[i].lfsMetaObject, err = git_model.NewLFSMetaObject(infos[i].lfsMetaObject) if err != nil { // OK Now we need to cleanup return cleanUpAfterFailure(&infos, t, err) @@ -175,7 +176,7 @@ func copyUploadedLFSFileIntoRepository(info *uploadInfo, filename2attribute2info return err } - info.lfsMetaObject = &models.LFSMetaObject{Pointer: pointer, RepositoryID: t.repo.ID} + info.lfsMetaObject = &git_model.LFSMetaObject{Pointer: pointer, RepositoryID: t.repo.ID} if objectHash, err = t.HashObject(strings.NewReader(pointer.StringContent())); err != nil { return err |