From 242b0eb219dbb269deacdae76de2f8b0b788ac40 Mon Sep 17 00:00:00 2001 From: Pedro Lopes Date: Tue, 28 Jul 2020 15:55:14 -0500 Subject: pkg: get and store Maintainers data Create a struct on pkg/vcs to store data of syzkaller email recipients and update its users. The struct contains default name, email, and a label to divide user into To and Cc when sending the emails. --- pkg/vcs/git.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'pkg/vcs/git.go') diff --git a/pkg/vcs/git.go b/pkg/vcs/git.go index 57cc215c6..ae4325a7f 100644 --- a/pkg/vcs/git.go +++ b/pkg/vcs/git.go @@ -196,8 +196,8 @@ func gitParseCommit(output, user, domain []byte, ignoreCC map[string]bool) (*Com if err != nil { return nil, fmt.Errorf("failed to parse date in git log output: %v\n%q", err, output) } - cc := make(map[string]bool) - cc[strings.ToLower(string(lines[2]))] = true + recipients := make(map[string]bool) + recipients[strings.ToLower(string(lines[2]))] = true var tags []string // Use summary line + all description lines. for _, line := range append([][]byte{lines[1]}, lines[6:]...) { @@ -235,15 +235,15 @@ func gitParseCommit(output, user, domain []byte, ignoreCC map[string]bool) (*Com if ignoreCC[email] { continue } - cc[email] = true + recipients[email] = true break } } - sortedCC := make([]string, 0, len(cc)) - for addr := range cc { - sortedCC = append(sortedCC, addr) + sortedRecipients := make(Recipients, 0, len(recipients)) + for addr := range recipients { + sortedRecipients = append(sortedRecipients, RecipientInfo{mail.Address{Address: addr}, To}) } - sort.Strings(sortedCC) + sort.Sort(sortedRecipients) parents := strings.Split(string(lines[5]), " ") com := &Commit{ Hash: string(lines[0]), @@ -251,7 +251,7 @@ func gitParseCommit(output, user, domain []byte, ignoreCC map[string]bool) (*Com Author: string(lines[2]), AuthorName: string(lines[3]), Parents: parents, - CC: sortedCC, + Recipients: sortedRecipients, Tags: tags, Date: date, } -- cgit mrf-deployment