Backport to v1.12 for #12341 - Release date fix (#12351)

* Backport for Issue #12341 PR #12343 - Release date fix

* Adds sleep for comparing times

* Fixes imports

* Fixes tests
This commit is contained in:
Richard Mahn 2020-07-28 14:10:50 -04:00 committed by GitHub
parent 9bac656b7d
commit 87bfe02b5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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)