1
0
Fork 0
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:
KN4CK3R 2021-08-09 20:08:51 +02:00 committed by GitHub
parent 23d438f565
commit d9ef43a712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 183 additions and 302 deletions

View file

@ -7,7 +7,6 @@ package git
import (
"bytes"
"container/list"
"context"
"fmt"
"os"
@ -33,10 +32,10 @@ func (repo *Repository) GetAllCommitsCount() (int64, error) {
return AllCommitsCount(repo.Path, false)
}
func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, error) {
l := list.New()
func (repo *Repository) parsePrettyFormatLogToList(logs []byte) ([]*Commit, error) {
var commits []*Commit
if len(logs) == 0 {
return l, nil
return commits, nil
}
parts := bytes.Split(logs, []byte{'\n'})
@ -46,10 +45,10 @@ func (repo *Repository) parsePrettyFormatLogToList(logs []byte) (*list.List, err
if err != nil {
return nil, err
}
l.PushBack(commit)
commits = append(commits, commit)
}
return l, nil
return commits, nil
}
// IsRepoURLAccessible checks if given repository URL is accessible.