-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug fix for repo releases sorted #3522
Conversation
routers/api/v1/repo/release.go
Outdated
@@ -147,6 +150,7 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) { | |||
IsPrerelease: form.IsPrerelease, | |||
IsTag: false, | |||
Repo: ctx.Repo.Repository, | |||
CreatedUnix: util.TimeStamp(time.Now().Unix()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be done in xorm before save event
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for this reason, so caused the issue that repo releases sorted when migrating, xorm
save current time rather than tag created time. Test passed on local, but CI failed, could you take a look at this?
models/release.go
Outdated
@@ -134,6 +135,8 @@ func createTag(gitRepo *git.Repository, rel *Release) error { | |||
if err != nil { | |||
return fmt.Errorf("CommitsCount: %v", err) | |||
} | |||
} else { | |||
rel.CreatedUnix = util.TimeStamp(time.Now().Unix()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to util.TimeStampNow()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated and the CI passed as well.
Signed-off-by: Wendell Sun <[email protected]> Use TimeStampNow function
Codecov Report
@@ Coverage Diff @@
## master #3522 +/- ##
==========================================
+ Coverage 35.73% 35.74% +<.01%
==========================================
Files 284 284
Lines 40775 40778 +3
==========================================
+ Hits 14571 14576 +5
+ Misses 24043 24041 -2
Partials 2161 2161
Continue to review full report at Codecov.
|
Would it be worth adding a migration (in a separate PR) to fix the |
@xwjdsh Can you please backport this to release/v1.4 branch? |
Signed-off-by: Wendell Sun <[email protected]> Use TimeStampNow function
Signed-off-by: Wendell Sun <[email protected]> Use TimeStampNow function
Fixes #3496