CONTRIBUTORS.gen

Summary

Maintainability
Test Coverage
#!/bin/sh
# This script regenerates the CONTRIBUTORS file from the git log.
# It uses .mailmap to normalise author names.

set -o errexit -o pipefail -o nounset

# File to which the list of contributors will be written.
out_file=$(dirname $0)/CONTRIBUTORS

# Regular expression for lines which should be excluded (in a syntax
# appropriate for grep(1)).
exclude_regex="dependabot"

# Write header.
cat >$out_file <<EOF
The contents of this repository are the work of the following named individuals:
EOF

# Find and write contributor list.
git log --format='%aN <%aE>' | sort --unique | grep -v "$exclude_regex" >>$out_file

# Write footer.
cat >>$out_file <<EOF

This file was automatically generated by CONTRIBUTORS.gen.
Do not edit by hand!
EOF

echo >&2 "Wrote $out_file"
echo >&2 "Please review the output and correct any names or email addresses by updating .mailmap"