Skip to content

Commit 13bba76

Browse files
committed
Add src/etc/add-authors.sh script for managing the AUTHORS.txt file
This is the kind of dumb task that gets done a different way every time and is easily automated.
1 parent bc8d862 commit 13bba76

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/etc/add-authors.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
4+
# file at the top-level directory of this distribution and at
5+
# http://rust-lang.org/COPYRIGHT.
6+
#
7+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
8+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
9+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
10+
# option. This file may not be copied, modified, or distributed
11+
# except according to those terms.
12+
13+
# This script, invoked e.g. "add-authors.sh 1.0.0..rust-lang/master",
14+
# will merge new authors into AUTHORS.txt, obeying the mailmap
15+
# file.
16+
#
17+
# After running this script, run `git diff` to manually inspect
18+
# changes. If there are incorrect additions fix it by editing
19+
# .mailmap and re-running the script.
20+
21+
set -u -e
22+
23+
range="$1"
24+
25+
authors_file="./AUTHORS.txt"
26+
tmp_file="./AUTHORS.txt.tmp"
27+
old_authors="$(cat "$authors_file" | tail -n +2 | sed "/^$/d" | sort)"
28+
new_authors="$(git log "$range" --format="%aN <%aE>" | sort | uniq)"
29+
30+
echo "Rust was written by these fine people:\n" > "$tmp_file"
31+
echo "$old_authors\n$new_authors" | sort | uniq >> "$tmp_file"
32+
mv -f "$tmp_file" "$authors_file"

0 commit comments

Comments
 (0)