2021-06-24 02:42:38 +05:30
|
|
|
// Copyright 2021 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
2021-09-19 17:19:59 +05:30
|
|
|
"code.gitea.io/gitea/models/db"
|
2021-06-24 02:42:38 +05:30
|
|
|
|
2021-12-06 12:49:28 +05:30
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
2021-06-24 02:42:38 +05:30
|
|
|
)
|
|
|
|
|
2021-12-06 12:49:28 +05:30
|
|
|
// LoadArchiverRepo loads repository
|
|
|
|
func LoadArchiverRepo(archiver *repo_model.RepoArchiver) (*Repository, error) {
|
2021-06-24 02:42:38 +05:30
|
|
|
var repo Repository
|
2021-09-23 21:15:36 +05:30
|
|
|
has, err := db.GetEngine(db.DefaultContext).ID(archiver.RepoID).Get(&repo)
|
2021-06-24 02:42:38 +05:30
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
if !has {
|
|
|
|
return nil, ErrRepoNotExist{
|
|
|
|
ID: archiver.RepoID,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return &repo, nil
|
|
|
|
}
|