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

Fix #17543
tokarchuk/v1.17
Lunny Xiao 3 years ago committed by GitHub
parent de9625e485
commit a161c2ca58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      modules/convert/git_commit.go

@ -149,6 +149,7 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
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{
@ -171,6 +172,7 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
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,

Loading…
Cancel
Save