diff --git a/.mailmap b/.mailmap new file mode 100644 index 00000000..3ef66c47 --- /dev/null +++ b/.mailmap @@ -0,0 +1,5 @@ +Changbin Du +Geliang Tang +Herbert Xu +Maxim Mikityanskiy +Quentin Monnet diff --git a/scripts/mailmap-update.sh b/scripts/mailmap-update.sh new file mode 100755 index 00000000..7d12eb38 --- /dev/null +++ b/scripts/mailmap-update.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -eu + +usage () { + echo "USAGE: ./update-mailmap.sh " + exit 1 +} + +BPFTOOL_REPO=${1-""} +LINUX_REPO=${2-""} + +if [ -z "${BPFTOOL_REPO}" ] || [ -z "${LINUX_REPO}" ]; then + echo "Error: bpftool or linux repos are not specified" + usage +fi + +BPFTOOL_MAILMAP="${BPFTOOL_REPO}/.mailmap" +LINUX_MAILMAP="${LINUX_REPO}/.mailmap" + +tmpfile="$(mktemp)" +cleanup() { + rm -f "${tmpfile}" +} +trap cleanup EXIT + +grep_lines() { + local pattern="$1" + local file="$2" + grep "${pattern}" "${file}" || true +} + +while read -r email; do + grep_lines "${email}$" "${LINUX_MAILMAP}" >> "${tmpfile}" +done < <(git log --format='<%ae>' | sort -u) + +sort -u "${tmpfile}" > "${BPFTOOL_MAILMAP}"