2016-10-23 03:47:45 +08:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
# This script generates the AUTHORS file from Git history.
|
|
|
|
|
|
|
|
echo '# This file lists all individuals having contributed content to the repository.'
|
|
|
|
echo '# This list was auto-generated from Git history.'
|
|
|
|
echo
|
|
|
|
|
2020-03-22 04:40:09 +08:00
|
|
|
function list_authors
|
|
|
|
# List existing authors
|
|
|
|
git show HEAD:AUTHORS | sed -e '/^$/d' -e '/^#/d'
|
|
|
|
|
|
|
|
# List any new authors
|
|
|
|
git log --format='%aN <%aE>' | awk '
|
|
|
|
{
|
|
|
|
pos = index($0, "<");
|
|
|
|
name = substr($0, 0, pos - 2);
|
|
|
|
email = substr($0, pos + 1, length($0) - pos - 1);
|
|
|
|
names[name]++;
|
|
|
|
emails[email]++;
|
|
|
|
if (names[name] == 1 && emails[email] == 1) {
|
|
|
|
print $0;
|
|
|
|
}
|
2016-10-23 03:47:45 +08:00
|
|
|
}
|
2020-03-22 04:40:09 +08:00
|
|
|
'
|
|
|
|
end
|
|
|
|
|
|
|
|
list_authors | env LC_ALL=C.UTF-8 sort -uf
|