1
0
mirror of https://github.com/go-gitea/gitea synced 2024-12-24 03:35:55 +01:00

Fix zero created time bug on commit api (#17546)

Fix #17543
This commit is contained in:
Lunny Xiao 2021-11-05 13:30:46 +08:00 committed by GitHub
parent de9625e485
commit a161c2ca58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -147,8 +147,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
return &api.Commit{ return &api.Commit{
CommitMeta: &api.CommitMeta{ CommitMeta: &api.CommitMeta{
URL: repo.APIURL() + "/git/commits/" + commit.ID.String(), URL: repo.APIURL() + "/git/commits/" + commit.ID.String(),
SHA: commit.ID.String(), SHA: commit.ID.String(),
Created: commit.Committer.When,
}, },
HTMLURL: repo.HTMLURL() + "/commit/" + commit.ID.String(), HTMLURL: repo.HTMLURL() + "/commit/" + commit.ID.String(),
RepoCommit: &api.RepoCommit{ RepoCommit: &api.RepoCommit{
@ -169,8 +170,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
}, },
Message: commit.Message(), Message: commit.Message(),
Tree: &api.CommitMeta{ Tree: &api.CommitMeta{
URL: repo.APIURL() + "/git/trees/" + commit.ID.String(), URL: repo.APIURL() + "/git/trees/" + commit.ID.String(),
SHA: commit.ID.String(), SHA: commit.ID.String(),
Created: commit.Committer.When,
}, },
}, },
Author: apiAuthor, Author: apiAuthor,