forked from tangled.org/core
Monorepo for Tangled — https://tangled.org

types: deduplicate coauthors list

Signed-off-by: oppiliappan <me@oppi.li>

oppi.li 8e41fb4c 80a70ca4

verified
Changed files
+6 -1
types
+6 -1
types/commit.go
···
func (commit Commit) CoAuthors() []object.Signature {
var coAuthors []object.Signature
-
matches := coAuthorRegex.FindAllStringSubmatch(commit.Message, -1)
for _, match := range matches {
if len(match) >= 3 {
name := strings.TrimSpace(match[1])
email := strings.TrimSpace(match[2])
coAuthors = append(coAuthors, object.Signature{
Name: name,
···
func (commit Commit) CoAuthors() []object.Signature {
var coAuthors []object.Signature
+
seen := make(map[string]bool)
matches := coAuthorRegex.FindAllStringSubmatch(commit.Message, -1)
for _, match := range matches {
if len(match) >= 3 {
name := strings.TrimSpace(match[1])
email := strings.TrimSpace(match[2])
+
+
if seen[email] {
+
continue
+
}
+
seen[email] = true
coAuthors = append(coAuthors, object.Signature{
Name: name,