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:
KN4CK3Rand6543 authored and GitHub committed 2021-08-09 14:08:51 -04:00
1 parent 23d438f565
commit d9ef43a712
29 files changed
+183 -302

No files matched your search

+5 -6
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.