aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/vcs/git.go
diff options
context:
space:
mode:
authorPedro Lopes <pedrolopes@google.com>2020-07-28 15:55:14 -0500
committerDmitry Vyukov <dvyukov@google.com>2020-07-31 17:18:29 +0200
commit242b0eb219dbb269deacdae76de2f8b0b788ac40 (patch)
tree2a1350d88d2550069a295ca7b093b00664209e64 /pkg/vcs/git.go
parent68aca71e8de884b64dc78a5d5406ca232460c1cf (diff)
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.
Diffstat (limited to 'pkg/vcs/git.go')
-rw-r--r--pkg/vcs/git.go16
1 files changed, 8 insertions, 8 deletions
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,
}