From 6673ce0fdd4bb727208be0cbea59585179758a1c Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Tue, 2 Apr 2013 13:34:55 -0400 Subject: [PATCH] Fix get-authors script to not extract email addresses, canonicalize names, add .mailmap --- .mailmap | 13 +++++++++++++ contrib/get-authors | 11 +++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 .mailmap diff --git a/.mailmap b/.mailmap new file mode 100644 index 000000000..1560f0272 --- /dev/null +++ b/.mailmap @@ -0,0 +1,13 @@ +Morgan Deters +Morgan Deters +Dejan Jovanovic +Dejan Jovanovic +Francois Bobot +Liana Hadarean +Andrew Reynolds +Cesare Tinelli +Christopher L. Conway +Clark Barrett +Kshitij Bansal +Tianyi Liang +Tim King diff --git a/contrib/get-authors b/contrib/get-authors index 118ca4466..0fe71dca3 100755 --- a/contrib/get-authors +++ b/contrib/get-authors @@ -11,6 +11,13 @@ gituser="`git config user.name` <`git config user.email`>" +if [ "$1" = "--email" ]; then + strip_email=cat + shift +else + strip_email="sed 's, *<[^>]*@[^>]*>,,g'" +fi + while [ $# -gt 0 ]; do f=$1 shift @@ -18,7 +25,7 @@ while [ $# -gt 0 ]; do major_contributors= minor_contributors= total_lines=`wc -l "$f" | awk '{print$1}'` - original_author=`git log --pretty="format:%aN <%aE>" "$f" | tail -1` + original_author=`git log --use-mailmap --pretty="format:%aN <%aE>" "$f" | tail -1` git blame --incremental "$f" | gawk '/^[0-9a-f]+ [0-9]+ [0-9]+ [0-9]+$/ {nl=$4;} /^author / {$1=""; author=$0;} /^author-mail / {mail=$2} /^filename / {while(nl--) {print author,mail}}' | sed "s,Not Committed Yet ,$gituser," | sort | uniq -c | sort -n | ( while read lines author; do pct=$((100*$lines/$total_lines)) @@ -32,5 +39,5 @@ while [ $# -gt 0 ]; do done; \ echo "$original_author" echo "${major_contributors:-none}" - echo "${minor_contributors:-none}" ) + echo "${minor_contributors:-none}" ) | eval "$strip_email" done -- 2.30.2