Skip to content

Commit

Permalink
chore(setup): update mailmap file
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsneighbour committed Dec 24, 2024
1 parent b44f0e4 commit c706a6d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<patrick@davids-neighbour.com> <83281+davidsneighbour@users.noreply.github.com>
<runner@local> <runner@Mac-1716077439935.local>
<runner@local> <runner@Mac-1716164017250.local>
<runner@local> <runner@Mac-1716042973551.local>
35 changes: 35 additions & 0 deletions scripts/mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

paster() {
# shellcheck disable=SC2162
while read email; do
[ -z "$email" ] || echo "$1" "$email"
done
}

grouper() {
IFS="<"
# shellcheck disable=SC2162
read x cur_name email
canonical_email="<"${email}
cur_emails=""

# shellcheck disable=SC2034,SC2162
while read x name email; do
if [ "$name" = "$cur_name" ]; then
cur_emails="$cur_emails <${email}"
else
echo "$cur_emails" | tr ' ' '\n' | paster "$canonical_email"
cur_name="$name"
canonical_email="<"${email}
cur_emails=""
fi
done
echo "$cur_emails" | tr ' ' '\n' | paster "$canonical_email"
}

root_dir="$(git rev-parse --show-cdup)"
root_dir="${root_dir:-.}"
cd "$root_dir" || exit
git shortlog -s -e | tr '\t' '<' | sort -t '<' -k 2,2 -k 1,1nr | grouper | tee "${1:--a}" .mailmap
git add .mailmap

0 comments on commit c706a6d

Please sign in to comment.