Files
libbpf/scripts/mailmap-update.sh
T
Ihor Solodrai fbcd832e27 sync: sort .mailmap independently of the locale
mailmap-update.sh sorts .mailmap with the caller's locale collation, so
the order of its entries depends on who runs the sync: e.g., with
en_US.UTF-8 vs C.UTF-8 (the default on GitHub runners). Syncs done in
different environments would keep reordering the file.

Always sort with LC_ALL=C.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
2026-10-02 13:04:03 -07:00

39 lines
817 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
usage () {
echo "USAGE: ./mailmap-update.sh <libbpf-repo> <linux-repo>"
exit 1
}
LIBBPF_REPO="${1-""}"
LINUX_REPO="${2-""}"
if [ -z "${LIBBPF_REPO}" ] || [ -z "${LINUX_REPO}" ]; then
echo "Error: libbpf or linux repos are not specified"
usage
fi
LIBBPF_MAILMAP="${LIBBPF_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 independently of the locale, for the result not to depend on who runs it
LC_ALL=C sort -u "${tmpfile}" > "${LIBBPF_MAILMAP}"