diff options
author | Philidor Green <fishbullet@users.noreply.github.com> | 2020-03-24 17:03:05 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-24 22:03:05 +0800 |
commit | 87053c53696e1d53cd90552770fe75e706997c38 (patch) | |
tree | fc5947a6fd5bfa59d9c98fe63b43adc9882569a3 /internal/db | |
parent | e14b6abf9dae13bc087c9d9db8fe7c7a5125c792 (diff) |
cmd: backup support exclude mirror repositories (#6003)
* cmd: backup support exclude mirror repositories
* Apply suggestions from code review
Co-authored-by: ᴜɴᴋɴᴡᴏɴ <u@gogs.io>
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/repo.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/db/repo.go b/internal/db/repo.go index 8f797e9b..7c27b26a 100644 --- a/internal/db/repo.go +++ b/internal/db/repo.go @@ -1427,6 +1427,16 @@ func GetRepositoriesByForkID(forkID int64) ([]*Repository, error) { return getRepositoriesByForkID(x, forkID) } +func getNonMirrorRepositories(e Engine) ([]*Repository, error) { + repos := make([]*Repository, 0, 10) + return repos, e.Where("is_mirror = ?", false).Find(&repos) +} + +// GetRepositoriesMirror returns only mirror repositories with user. +func GetNonMirrorRepositories() ([]*Repository, error) { + return getNonMirrorRepositories(x) +} + func updateRepository(e Engine, repo *Repository, visibilityChanged bool) (err error) { repo.LowerName = strings.ToLower(repo.Name) |