diff options
author | Thibault Meyer <0xbaadf00d@users.noreply.github.com> | 2016-08-06 19:02:15 +0200 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-08-06 10:02:15 -0700 |
commit | 30fda0f1aecbb45b0abc67e0fb9fdb806a52cb8c (patch) | |
tree | d77c80e223c3b1aa56c195fd6138d83a594bd021 /routers/repo/release.go | |
parent | ab9c5fb5e7f7b04580e2c53ae08bed3f6623316f (diff) | |
download | gitea-30fda0f1aecbb45b0abc67e0fb9fdb806a52cb8c.tar.gz gitea-30fda0f1aecbb45b0abc67e0fb9fdb806a52cb8c.zip |
Fix #3315: Release dont use tag creation date (#3374)
* Fix #3315: Release dont use tag creation date
* Simplify code and apply gofmt
* remove useless block (ctx.Repo.GitRepo.GetTag) on EditReleasePost
* apply gofmt on modified files
Diffstat (limited to 'routers/repo/release.go')
-rw-r--r-- | routers/repo/release.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go index 672741c5ba..efbe6c982f 100644 --- a/routers/repo/release.go +++ b/routers/repo/release.go @@ -167,6 +167,15 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) { return } + var tagCreatedUnix int64 + tag, err := ctx.Repo.GitRepo.GetTag(form.TagName) + if err == nil { + commit, err := tag.Commit() + if err == nil { + tagCreatedUnix = commit.Author.When.Unix() + } + } + commit, err := ctx.Repo.GitRepo.GetBranchCommit(form.Target) if err != nil { ctx.Handle(500, "GetBranchCommit", err) @@ -190,6 +199,7 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) { Note: form.Content, IsDraft: len(form.Draft) > 0, IsPrerelease: form.Prerelease, + CreatedUnix: tagCreatedUnix, } if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil { |