mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-22 03:30:35 +00:00
build: deduplicate same authors with different casing
This commit is contained in:
parent
1a83114c74
commit
b973eddd28
2
AUTHORS
2
AUTHORS
@ -122,7 +122,6 @@ Gus <yo@soygus.com>
|
||||
Gustav Simonsson <gustav.simonsson@gmail.com>
|
||||
Gísli Kristjánsson <gislik@hamstur.is>
|
||||
Ha ĐANG <dvietha@gmail.com>
|
||||
hackyminer <hackyminer@gmail.com>
|
||||
HackyMiner <hackyminer@gmail.com>
|
||||
hadv <dvietha@gmail.com>
|
||||
Hao Bryan Cheng <haobcheng@gmail.com>
|
||||
@ -257,7 +256,6 @@ Paul Litvak <litvakpol@012.net.il>
|
||||
Paulo L F Casaretto <pcasaretto@gmail.com>
|
||||
Paweł Bylica <chfast@gmail.com>
|
||||
Pedro Pombeiro <PombeirP@users.noreply.github.com>
|
||||
Pedro Pombeiro <pombeirp@users.noreply.github.com>
|
||||
Peter Broadhurst <peter@themumbles.net>
|
||||
Peter Pratscher <pratscher@gmail.com>
|
||||
Petr Mikusek <petr@mikusek.info>
|
||||
|
@ -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")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user