Skip to content

Commit a161c2c

Browse files
authored
Fix zero created time bug on commit api (#17546)
Fix #17543
1 parent de9625e commit a161c2c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/convert/git_commit.go

+6-4
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
147147

148148
return &api.Commit{
149149
CommitMeta: &api.CommitMeta{
150-
URL: repo.APIURL() + "/git/commits/" + commit.ID.String(),
151-
SHA: commit.ID.String(),
150+
URL: repo.APIURL() + "/git/commits/" + commit.ID.String(),
151+
SHA: commit.ID.String(),
152+
Created: commit.Committer.When,
152153
},
153154
HTMLURL: repo.HTMLURL() + "/commit/" + commit.ID.String(),
154155
RepoCommit: &api.RepoCommit{
@@ -169,8 +170,9 @@ func ToCommit(repo *models.Repository, commit *git.Commit, userCache map[string]
169170
},
170171
Message: commit.Message(),
171172
Tree: &api.CommitMeta{
172-
URL: repo.APIURL() + "/git/trees/" + commit.ID.String(),
173-
SHA: commit.ID.String(),
173+
URL: repo.APIURL() + "/git/trees/" + commit.ID.String(),
174+
SHA: commit.ID.String(),
175+
Created: commit.Committer.When,
174176
},
175177
},
176178
Author: apiAuthor,

0 commit comments

Comments
 (0)