Skip to content

Commit

Permalink
Code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lafriks committed Sep 16, 2017
1 parent 1924c25 commit 7a4e467
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions models/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ func DeleteReleaseByID(id int64, u *User, delTag bool) error {

// SyncReleasesWithTags synchronizes release table with repository tags
func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
checked := make([]string, 100)
existingRelTags := make(map[string]struct{})
opts := FindReleasesOptions{IncludeDrafts: true, IncludeTags: true}
page := 0
for {
Expand All @@ -446,7 +446,7 @@ func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
return fmt.Errorf("pushUpdateDeleteTag: %v", err)
}
} else {
checked = append(checked, rel.TagName)
existingRelTags[strings.ToLower(rel.TagName)] = struct{}{}
}
}
}
Expand All @@ -455,16 +455,11 @@ func SyncReleasesWithTags(repo *Repository, gitRepo *git.Repository) error {
return fmt.Errorf("GetTags: %v", err)
}
for _, tagName := range tags {
exists := false
for _, relTagName := range checked {
if tagName == relTagName {
exists = true
break
if _, ok := existingRelTags[strings.ToLower(tagName)]; !ok {
if err := pushUpdateAddTag(repo, gitRepo, tagName); err != nil {
return fmt.Errorf("pushUpdateAddTag: %v", err)
}
}
if !exists {
pushUpdateAddTag(repo, gitRepo, tagName)
}
}
return nil
}

0 comments on commit 7a4e467

Please sign in to comment.