Skip to content

Commit b973edd

Browse files
committed
build: deduplicate same authors with different casing
1 parent 1a83114 commit b973edd

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

AUTHORS

-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ Gus <yo@soygus.com>
122122
Gustav Simonsson <gustav.simonsson@gmail.com>
123123
Gísli Kristjánsson <gislik@hamstur.is>
124124
Ha ĐANG <dvietha@gmail.com>
125-
hackyminer <hackyminer@gmail.com>
126125
HackyMiner <hackyminer@gmail.com>
127126
hadv <dvietha@gmail.com>
128127
Hao Bryan Cheng <haobcheng@gmail.com>
@@ -257,7 +256,6 @@ Paul Litvak <litvakpol@012.net.il>
257256
Paulo L F Casaretto <pcasaretto@gmail.com>
258257
Paweł Bylica <chfast@gmail.com>
259258
Pedro Pombeiro <PombeirP@users.noreply.github.com>
260-
Pedro Pombeiro <pombeirp@users.noreply.github.com>
261259
Peter Broadhurst <peter@themumbles.net>
262260
Peter Pratscher <pratscher@gmail.com>
263261
Petr Mikusek <petr@mikusek.info>

build/update-license.go

+14-9
Original file line numberDiff line numberDiff line change
@@ -275,27 +275,32 @@ func mailmapLookup(authors []string) []string {
275275
}
276276

277277
func writeAuthors(files []string) {
278-
merge := make(map[string]bool)
278+
var (
279+
dedup = make(map[string]bool)
280+
list []string
281+
)
279282
// Add authors that Git reports as contributors.
280283
// This is the primary source of author information.
281284
for _, a := range gitAuthors(files) {
282-
merge[a] = true
285+
if la := strings.ToLower(a); !dedup[la] {
286+
list = append(list, a)
287+
dedup[la] = true
288+
}
283289
}
284290
// Add existing authors from the file. This should ensure that we
285291
// never lose authors, even if Git stops listing them. We can also
286292
// add authors manually this way.
287293
for _, a := range readAuthors() {
288-
merge[a] = true
294+
if la := strings.ToLower(a); !dedup[la] {
295+
list = append(list, a)
296+
dedup[la] = true
297+
}
289298
}
290299
// Write sorted list of authors back to the file.
291-
var result []string
292-
for a := range merge {
293-
result = append(result, a)
294-
}
295-
sort.Sort(authors(result))
300+
sort.Sort(authors(list))
296301
content := new(bytes.Buffer)
297302
content.WriteString(authorsFileHeader)
298-
for _, a := range result {
303+
for _, a := range list {
299304
content.WriteString(a)
300305
content.WriteString("\n")
301306
}

0 commit comments

Comments
 (0)