Skip to content

Commit ad847cc

Browse files
josdejonggwhitney
andauthored
Fix #2524: ignore specific commits when running update-authors.js (#2543)
Co-authored-by: Glen Whitney <[email protected]>
1 parent 3c49fca commit ad847cc

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ thetazero <[email protected]>
178178
Alfonso Valenciana <[email protected]>
179179
180180
Glen Whitney <[email protected]>
181-
Divya Yeruva <[email protected]>
182181
Eternal-Rise <[email protected]>
183182
184183
NattapongSiri <[email protected]>
@@ -187,6 +186,7 @@ Abraham <[email protected]>
187186
Sam Estep <[email protected]>
188187
189188
189+
Divya Yeruva <[email protected]>
190190
simlaticak <[email protected]>
191191

192192
# Generated by tools/update-authors.js

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
of those functions (#2531, #2539). Thanks @simlaticak and @gwhitney.
88
- Fix #2532: matrix index symbol `end` not working when used inside
99
a sub-expression.
10+
- Fix #2524: In generating AUTHORS list, ignore a list of specific commits
11+
(e.g., to avoid spurious duplicates in list). (#2543)
1012

1113

1214
# 2022-04-19, version 10.5.0

tools/update-authors.js

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class CaseIndifferentMap {
2525
const log = spawn(
2626
'git',
2727
// Inspect author name/email and body.
28-
['log', '--reverse', '--format=Author: %aN <%aE>\n%b'], {
28+
['log', '--reverse'],
29+
{
2930
stdio: ['inherit', 'pipe', 'inherit']
3031
})
3132
const rl = readline.createInterface({ input: log.stdout })
@@ -77,17 +78,40 @@ const mailmap = new CaseIndifferentMap()
7778

7879
const seen = new Set()
7980

81+
// Commits from which we do not want the author to pop up in the AUTHORS list,
82+
// for example because the commit was done with a wrong git user account
83+
const ignoreCommits = [
84+
'43d4551e7c19f51d30e71b35009437c7ec6491f0'
85+
]
86+
let currentCommit
87+
8088
// Support regular git author metadata, as well as `Author:` and
8189
// `Co-authored-by:` in the message body. Both have been used in the past
8290
// to indicate multiple authors per commit, with the latter standardized
8391
// by GitHub now.
8492
const authorRe =
85-
/(^Author:|^Co-authored-by:)\s+(?<author>[^<]+)\s+(?<email><[^>]+>)/i
93+
/(^Author:|^\s*Co-authored-by:)\s+(?<author>[^<]+)\s+(?<email><[^>]+>)/i
94+
95+
// Commit line regex. Example: "commit 123456"
96+
const commitRe = /^commit (?<commit>.+)$/i
97+
8698
rl.on('line', (line) => {
87-
const match = line.match(authorRe)
88-
if (!match) return
99+
const commitMatch = line.match(commitRe)
100+
if (commitMatch) {
101+
currentCommit = commitMatch.groups.commit
102+
return
103+
}
104+
105+
if (ignoreCommits.includes(currentCommit)) {
106+
return
107+
}
108+
109+
const authorMatch = line.match(authorRe)
110+
if (!authorMatch) {
111+
return
112+
}
89113

90-
const { author, email } = match.groups
114+
const { author, email } = authorMatch.groups
91115

92116
if (seen.has(email) ||
93117
/@chromium\.org/.test(email) ||

0 commit comments

Comments
 (0)