4 # Morgan Deters <mdeters@cs.nyu.edu> for CVC4
5 # Copyright (c) 2009-2013 The CVC4 Project
7 # usage: get-authors [ files... ]
9 # This script uses git to get the original author
12 gituser
="`git config user.name` <`git config user.email`>"
14 if [ "$1" = "--email" ]; then
18 strip_email
="sed 's, *<[^>]*@[^>]*>,,g'"
21 while [ $# -gt 0 ]; do
27 total_lines
=`wc -l "$f" | awk '{print$1}'`
28 original_author
=`git log --use-mailmap --pretty="format:%aN <%aE>" "$f" | tail -1`
29 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 |
30 ( while read lines author
; do
31 pct
=$
((100*$lines/$total_lines))
32 if [ "$author" != "$original_author" ]; then
33 if [ $pct -ge 10 ]; then
34 major_contributors
="${major_contributors:+$major_contributors, }$author"
36 minor_contributors
="${minor_contributors:+$minor_contributors, }$author"
40 echo "$original_author"
41 echo "${major_contributors:-none}"
42 echo "${minor_contributors:-none}" ) |
eval "$strip_email"