1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Fixes #12341: Release date should only be set to current time if draft or tag created (#12343)

* Fixes #12341: Release date should only be set to current time if draft or tag created

* Removes old date set

* Adds unit tests

* make fmt

* Fixes tests

* Adds sleep for comparing times

* Adds sleep for comparing times

* Fixes tests

Co-authored-by: Matti R <matti@mdranta.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
This commit is contained in:
Richard Mahn
2020-07-28 14:08:45 -04:00
committed by GitHub
parent cd7f1fd72b
commit 8a36c46a7e
2 changed files with 152 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ func createTag(gitRepo *git.Repository, rel *models.Release) error {
rel.Publisher, rel.Repo, git.TagPrefix+rel.TagName,
git.EmptySHA, commit.ID.String(), repository.NewPushCommits())
notification.NotifyCreateRef(rel.Publisher, rel.Repo, "tag", git.TagPrefix+rel.TagName)
rel.CreatedUnix = timeutil.TimeStampNow()
}
commit, err := gitRepo.GetTagCommit(rel.TagName)
if err != nil {
@@ -53,7 +54,6 @@ func createTag(gitRepo *git.Repository, rel *models.Release) error {
}
rel.Sha1 = commit.ID.String()
rel.CreatedUnix = timeutil.TimeStampNow()
rel.NumCommits, err = commit.CommitsCount()
if err != nil {
return fmt.Errorf("CommitsCount: %v", err)