diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-05 13:30:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-05 05:30:46 +0000 |
commit | a161c2ca5834e950f35fa7546b027f825d4bb5eb (patch) | |
tree | 64cc9d450bb94e726e52a9554e4e0ce3d7640ea1 /modules/convert | |
parent | de9625e48510c2e6ea65abfe50db6e552b655744 (diff) | |
download | gitea-a161c2ca5834e950f35fa7546b027f825d4bb5eb.tar.gz gitea-a161c2ca5834e950f35fa7546b027f825d4bb5eb.zip |
Fix zero created time bug on commit api (#17546)
Fix #17543
Diffstat (limited to 'modules/convert')
-rw-r--r-- | modules/convert/git_commit.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/convert/git_commit.go b/modules/convert/git_commit.go index fd4f12ecfa..9f43bb82f8 100644 --- a/modules/convert/git_commit.go +++ b/modules/convert/git_commit.go @@ -147,8 +147,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string] return &api.Commit{ CommitMeta: &api.CommitMeta{ - URL: repo.APIURL() + "/git/commits/" + commit.ID.String(), - SHA: commit.ID.String(), + URL: repo.APIURL() + "/git/commits/" + commit.ID.String(), + SHA: commit.ID.String(), + Created: commit.Committer.When, }, HTMLURL: repo.HTMLURL() + "/commit/" + commit.ID.String(), RepoCommit: &api.RepoCommit{ @@ -169,8 +170,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string] }, Message: commit.Message(), Tree: &api.CommitMeta{ - URL: repo.APIURL() + "/git/trees/" + commit.ID.String(), - SHA: commit.ID.String(), + URL: repo.APIURL() + "/git/trees/" + commit.ID.String(), + SHA: commit.ID.String(), + Created: commit.Committer.When, }, }, Author: apiAuthor, |