Add comment

This commit is contained in:
Roman Vynar 2022-09-01 18:16:48 +03:00
parent b7c5c52fa2
commit 975803a6a7

View File

@ -36,11 +36,12 @@ func (p timeSlice) Len() int {
} }
func (p timeSlice) Less(i, j int) bool { func (p timeSlice) Less(i, j int) bool {
// reverse sort tags on name if equal dates (OCI image case)
// see https://github.com/Quiq/docker-registry-ui/pull/62
if p[i].created.Equal(p[j].created) { if p[i].created.Equal(p[j].created) {
return p[i].name > p[j].name return p[i].name > p[j].name
} else {
return p[i].created.After(p[j].created)
} }
return p[i].created.After(p[j].created)
} }
func (p timeSlice) Swap(i, j int) { func (p timeSlice) Swap(i, j int) {
@ -86,10 +87,10 @@ func PurgeOldTags(client *Client, config *PurgeTagsConfig) {
} }
tags := client.Tags(repo) tags := client.Tags(repo)
logger.Infof("[%s] scanning %d tags...", repo, len(tags))
if len(tags) == 0 { if len(tags) == 0 {
continue continue
} }
logger.Infof("[%s] scanning %d tags...", repo, len(tags))
for _, tag := range tags { for _, tag := range tags {
_, infoV1, _ := client.TagInfo(repo, tag, true) _, infoV1, _ := client.TagInfo(repo, tag, true)
if infoV1 == "" { if infoV1 == "" {