summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/commits.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/api/v1/repo/commits.go')
-rw-r--r--routers/api/v1/repo/commits.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go
index e4bea4dee7..9950a7d456 100644
--- a/routers/api/v1/repo/commits.go
+++ b/routers/api/v1/repo/commits.go
@@ -190,20 +190,14 @@ func GetAllCommits(ctx *context.APIContext) {
userCache := make(map[string]*models.User)
- apiCommits := make([]*api.Commit, commits.Len())
-
- i := 0
- for commitPointer := commits.Front(); commitPointer != nil; commitPointer = commitPointer.Next() {
- commit := commitPointer.Value.(*git.Commit)
-
+ apiCommits := make([]*api.Commit, len(commits))
+ for i, commit := range commits {
// Create json struct
apiCommits[i], err = convert.ToCommit(ctx.Repo.Repository, commit, userCache)
if err != nil {
ctx.Error(http.StatusInternalServerError, "toCommit", err)
return
}
-
- i++
}
// kept for backwards compatibility