diff options
Diffstat (limited to 'models/gpg_key_commit_verification.go')
-rw-r--r-- | models/gpg_key_commit_verification.go | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/models/gpg_key_commit_verification.go b/models/gpg_key_commit_verification.go index f0c27f13aa..a4c7d70285 100644 --- a/models/gpg_key_commit_verification.go +++ b/models/gpg_key_commit_verification.go @@ -5,7 +5,6 @@ package models import ( - "container/list" "fmt" "hash" "strings" @@ -68,24 +67,19 @@ const ( ) // ParseCommitsWithSignature checks if signaute of commits are corresponding to users gpg keys. -func ParseCommitsWithSignature(oldCommits *list.List, repository *Repository) *list.List { - var ( - newCommits = list.New() - e = oldCommits.Front() - ) +func ParseCommitsWithSignature(oldCommits []*UserCommit, repository *Repository) []*SignCommit { + newCommits := make([]*SignCommit, 0, len(oldCommits)) keyMap := map[string]bool{} - for e != nil { - c := e.Value.(UserCommit) - signCommit := SignCommit{ - UserCommit: &c, + for _, c := range oldCommits { + signCommit := &SignCommit{ + UserCommit: c, Verification: ParseCommitWithSignature(c.Commit), } _ = CalculateTrustStatus(signCommit.Verification, repository, &keyMap) - newCommits.PushBack(signCommit) - e = e.Next() + newCommits = append(newCommits, signCommit) } return newCommits } |