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
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue