Fix get-authors script to not extract email addresses, canonicalize names, add .mailmap
authorMorgan Deters <mdeters@cs.nyu.edu>
Tue, 2 Apr 2013 17:34:55 +0000 (13:34 -0400)
committerMorgan Deters <mdeters@cs.nyu.edu>
Tue, 2 Apr 2013 18:35:35 +0000 (14:35 -0400)
.mailmap [new file with mode: 0644]
contrib/get-authors

diff --git a/.mailmap b/.mailmap
new file mode 100644 (file)
index 0000000..1560f02
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,13 @@
+Morgan Deters <mdeters@cs.nyu.edu> <mdeters@cs.nyu.edu>
+Morgan Deters <mdeters@cs.nyu.edu> <mdeters@gmail.com>
+Dejan Jovanovic <dejan@cs.nyu.edu> <dejan@cs.nyu.edu>
+Dejan Jovanovic <dejan@cs.nyu.edu> <dejan.jovanovic@gmail.com>
+Francois Bobot <francois@bobot.eu> <francois@bobot.eu>
+Liana Hadarean <lianah@cs.nyu.edu> <lianahady@gmail.com>
+Andrew Reynolds <andrew.j.reynolds@gmail.com> <andrew.j.reynolds@gmail.com>
+Cesare Tinelli <cesare-tinelli@uiowa.edu> <cesare-tinelli@uiowa.edu>
+Christopher L. Conway <christopherleeconway@gmail.com> <christopherleeconway@gmail.com>
+Clark Barrett <barrett@cs.nyu.edu> <barrett@cs.nyu.edu>
+Kshitij Bansal <kshitij@cs.nyu.edu> <kshitij@cs.nyu.edu>
+Tianyi Liang <tianyi-liang@uiowa.edu> <tianyi-liang@uiowa.edu>
+Tim King <taking@cs.nyu.edu> <taking@cs.nyu.edu>
index 118ca44662edb9d6234d2ef5fcc35eee0d5770be..0fe71dca39a488afcb4fcd0350cd69cc2a439745 100755 (executable)
 
 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 <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