forked from forgejo/forgejo
LFS support to be stored on minio (#12518)
* LFS support to be stored on minio * Fix test * Fix lint * Fix lint * Fix check * Fix test * Update documents and add migration for LFS * Fix some bugs
This commit is contained in:
parent
e4b3f35b8d
commit
7a5465fc56
18 changed files with 423 additions and 203 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/lfs"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/storage"
|
||||
)
|
||||
|
||||
// UploadRepoFileOptions contains the uploaded repository file options
|
||||
|
@ -163,12 +164,16 @@ func UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRep
|
|||
|
||||
// OK now we can insert the data into the store - there's no way to clean up the store
|
||||
// once it's in there, it's in there.
|
||||
contentStore := &lfs.ContentStore{BasePath: setting.LFS.ContentPath}
|
||||
contentStore := &lfs.ContentStore{ObjectStorage: storage.LFS}
|
||||
for _, uploadInfo := range infos {
|
||||
if uploadInfo.lfsMetaObject == nil {
|
||||
continue
|
||||
}
|
||||
if !contentStore.Exists(uploadInfo.lfsMetaObject) {
|
||||
exist, err := contentStore.Exists(uploadInfo.lfsMetaObject)
|
||||
if err != nil {
|
||||
return cleanUpAfterFailure(&infos, t, err)
|
||||
}
|
||||
if !exist {
|
||||
file, err := os.Open(uploadInfo.upload.LocalPath())
|
||||
if err != nil {
|
||||
return cleanUpAfterFailure(&infos, t, err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue