mirror of
1
Fork 0

Fix created_unix for mirroring (#32342)

Fix #32233

(cherry picked from commit 13a203828c40f9ad1005b16b4ae26256a7df8263)
This commit is contained in:
Lunny Xiao 2024-11-01 23:11:38 -07:00 committed by Gergely Nagy
parent befafe9a05
commit 268276d4a7
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -341,9 +341,10 @@ func pullMirrorReleaseSync(ctx context.Context, repo *repo_model.Repository, git
for _, tag := range updates { for _, tag := range updates {
if _, err := db.GetEngine(ctx).Where("repo_id = ? AND lower_tag_name = ?", repo.ID, strings.ToLower(tag.Name)). if _, err := db.GetEngine(ctx).Where("repo_id = ? AND lower_tag_name = ?", repo.ID, strings.ToLower(tag.Name)).
Cols("sha1"). Cols("sha1", "created_unix").
Update(&repo_model.Release{ Update(&repo_model.Release{
Sha1: tag.Object.String(), Sha1: tag.Object.String(),
CreatedUnix: timeutil.TimeStamp(tag.Tagger.When.Unix()),
}); err != nil { }); err != nil {
return fmt.Errorf("unable to update tag %s for pull-mirror Repo[%d:%s/%s]: %w", tag.Name, repo.ID, repo.OwnerName, repo.Name, err) return fmt.Errorf("unable to update tag %s for pull-mirror Repo[%d:%s/%s]: %w", tag.Name, repo.ID, repo.OwnerName, repo.Name, err)
} }