Skip to content

Commit

Permalink
build: deduplicate same authors with different casing
Browse files Browse the repository at this point in the history
  • Loading branch information
karalabe committed Jul 22, 2019
1 parent 1a83114 commit b973edd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 0 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ Gus <[email protected]>
Gustav Simonsson <[email protected]>
Gísli Kristjánsson <[email protected]>
Ha ĐANG <[email protected]>
hackyminer <[email protected]>
HackyMiner <[email protected]>
hadv <[email protected]>
Hao Bryan Cheng <[email protected]>
Expand Down Expand Up @@ -257,7 +256,6 @@ Paul Litvak <[email protected]>
Paulo L F Casaretto <[email protected]>
Paweł Bylica <[email protected]>
Pedro Pombeiro <[email protected]>
Pedro Pombeiro <[email protected]>
Peter Broadhurst <[email protected]>
Peter Pratscher <[email protected]>
Petr Mikusek <[email protected]>
Expand Down
23 changes: 14 additions & 9 deletions build/update-license.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,27 +275,32 @@ func mailmapLookup(authors []string) []string {
}

func writeAuthors(files []string) {
merge := make(map[string]bool)
var (
dedup = make(map[string]bool)
list []string
)
// Add authors that Git reports as contributors.
// This is the primary source of author information.
for _, a := range gitAuthors(files) {
merge[a] = true
if la := strings.ToLower(a); !dedup[la] {
list = append(list, a)
dedup[la] = true
}
}
// Add existing authors from the file. This should ensure that we
// never lose authors, even if Git stops listing them. We can also
// add authors manually this way.
for _, a := range readAuthors() {
merge[a] = true
if la := strings.ToLower(a); !dedup[la] {
list = append(list, a)
dedup[la] = true
}
}
// Write sorted list of authors back to the file.
var result []string
for a := range merge {
result = append(result, a)
}
sort.Sort(authors(result))
sort.Sort(authors(list))
content := new(bytes.Buffer)
content.WriteString(authorsFileHeader)
for _, a := range result {
for _, a := range list {
content.WriteString(a)
content.WriteString("\n")
}
Expand Down

0 comments on commit b973edd

Please sign in to comment.