diff options
Diffstat (limited to 'models/release.go')
-rw-r--r-- | models/release.go | 44 |
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"). |