forked from forgejo/forgejo
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:
parent
23d438f565
commit
d9ef43a712
29 changed files with 183 additions and 302 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue