From 30dcc26be848389a6d6f0af43a1a0b140f7b9954 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Tue, 26 May 2020 21:46:45 -0700 Subject: [PATCH] feat: support the mailmap file in mkreleasenotes This will use either the mailmap file in the current repo, or the mailmap file in the target repo, when generating the contributor stats. --- bin/mkreleaselog | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/bin/mkreleaselog b/bin/mkreleaselog index c30ee7051..0588adaee 100755 --- a/bin/mkreleaselog +++ b/bin/mkreleaselog @@ -33,15 +33,22 @@ AUTHORS=( NL=$'\n' +ROOT_DIR="$(git rev-parse --show-toplevel)" + msg() { echo "$*" >&2 } statlog() { - rpath="$GOPATH/src/$1" - start="${2:-}" - end="${3:-HEAD}" - git -C "$rpath" log --shortstat --no-merges --pretty="tformat:%H%n%aN%n%aE" "$start..$end" | while + local rpath="$GOPATH/src/$1" + local start="${2:-}" + local end="${3:-HEAD}" + local mailmap_file="$rpath/.mailmap" + if ! [[ -e "$mailmap_file" ]]; then + mailmap_file="$ROOT_DIR/.mailmap" + fi + + git -C "$rpath" -c mailmap.file="$mailmap_file" log --use-mailmap --shortstat --no-merges --pretty="tformat:%H%n%aN%n%aE" "$start..$end" | while read hash read name read email