summaryrefslogtreecommitdiffstats
path: root/models/release.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-12-15 01:30:01 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-12-14 18:30:01 +0100
commit7b2ff82d209c01be8082eaa9b888f93a00850d4d (patch)
treee3876a3f5c4b204b97bb0b611493c27453204a2c /models/release.go
parent2904abdc22da36a7110d0b69af0fd45cdb74ebf6 (diff)
downloadgitea-7b2ff82d209c01be8082eaa9b888f93a00850d4d.tar.gz
gitea-7b2ff82d209c01be8082eaa9b888f93a00850d4d.zip
Move some repository methods from models to modules/repository (#9353)
* Move some repository methods from models to modules/repository * fix test
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go44
1 files changed, 0 insertions, 44 deletions
diff --git a/models/release.go b/models/release.go
index a0f0621ab0..46f9e88752 100644
--- a/models/release.go
+++ b/models/release.go
@@ -10,7 +10,6 @@ import (
"sort"
"strings"
- "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
api "code.gitea.io/gitea/modules/structs"
@@ -318,49 +317,6 @@ func DeleteReleaseByID(id int64) error {
return err
}
-// SyncReleasesWithTags synchronizes release table with repository tags
-func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
- existingRelTags := make(map[string]struct{})
- opts := FindReleasesOptions{IncludeDrafts: true, IncludeTags: true}
- for page := 1; ; page++ {
- rels, err := GetReleasesByRepoID(repo.ID, opts, page, 100)
- if err != nil {
- return fmt.Errorf("GetReleasesByRepoID: %v", err)
- }
- if len(rels) == 0 {
- break
- }
- for _, rel := range rels {
- if rel.IsDraft {
- continue
- }
- commitID, err := gitRepo.GetTagCommitID(rel.TagName)
- if err != nil && !git.IsErrNotExist(err) {
- return fmt.Errorf("GetTagCommitID: %v", err)
- }
- if git.IsErrNotExist(err) || commitID != rel.Sha1 {
- if err := PushUpdateDeleteTag(repo, rel.TagName); err != nil {
- return fmt.Errorf("PushUpdateDeleteTag: %v", err)
- }
- } else {
- existingRelTags[strings.ToLower(rel.TagName)] = struct{}{}
- }
- }
- }
- tags, err := gitRepo.GetTags()
- if err != nil {
- return fmt.Errorf("GetTags: %v", err)
- }
- for _, tagName := range tags {
- if _, ok := existingRelTags[strings.ToLower(tagName)]; !ok {
- if err := PushUpdateAddTag(repo, gitRepo, tagName); err != nil {
- return fmt.Errorf("pushUpdateAddTag: %v", err)
- }
- }
- }
- return nil
-}
-
// UpdateReleasesMigrationsByType updates all migrated repositories' releases from gitServiceType to replace originalAuthorID to posterID
func UpdateReleasesMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, posterID int64) error {
_, err := x.Table("release").