-#!/bin/sh -ex
+#!/bin/sh
if [ -d .git ]; then
- echo "Updating authors...\n"
+ # Fetch full Git history if needed, e.g. when run via Travis-CI.
+ git fetch --unshallow 2>/dev/null
- # Full git history is needed for this to work
- # (hide stderr and return code since this fails in case full history is already available)
- git fetch --unshallow 2> /dev/null || true
-
- # collect "Co-authored-by" and Authors and update doc/AUTHORS.adoc
- { git log --pretty=format:"%(trailers)" | grep -Po "(?<=Co-authored-by: )(.*)(?= <)"; git log --format="%aN"; } | sed -e 's/^/* /' | LANG=en_US.utf8 sort -uf | perl -00 -p -i -e 's/^\*.*/<STDIN> . "\n"/es' doc/AUTHORS.adoc
+ # Update doc/AUTHORS.adoc with Git commit authors plus authors mentioned via
+ # a "Co-authored-by:" in the commit message.
+ (git log --pretty=format:"%(trailers)" | grep -Po "(?<=Co-authored-by: )(.*)(?= <)"; \
+ git log --format="%aN") \
+ | sed 's/^/* /' \
+ | LANG=en_US.utf8 sort -uf \
+ | perl -00 -p -i -e 's/^\*.*/<STDIN> . "\n"/es' doc/AUTHORS.adoc
fi