Skip to content

Commit f25f7c5

Browse files
lunnyzeripath
andauthored
Fix zero created time bug on commit api (#17547)
Co-authored-by: zeripath <[email protected]>
1 parent e8cf04b commit f25f7c5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/convert/git_commit.go

Lines changed: 6 additions & 4 deletions
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)