mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
Replace list.List
with slices (#16311)
* Replaced list with slice. * Fixed usage of pointer to temporary variable. * Replaced LIFO list with slice. * Lint * Removed type check. * Removed duplicated code. * Lint * Fixed merge. Co-authored-by: 6543 <6543@obermui.de>
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user