Skip to content

Instantly share code, notes, and snippets.

@JonnyJD
Created April 19, 2012 02:11
Show Gist options
  • Save JonnyJD/2417888 to your computer and use it in GitHub Desktop.
Save JonnyJD/2417888 to your computer and use it in GitHub Desktop.
list new contributors for a git branch (given a previous list)
#!/bin/sh
aliases=(aheadley Andrew "Two Words" "<mail@example.com>")
if [ $# -gt 0 ]; then
branch=$1
else
branch=master
fi
echo contributors in $branch:
# contributors with name and email
# sorted on last part of the name
git shortlog -se $branch \
| awk '{ print $(NF-1), $0 }' | sort \
| while read line;
do
orig_line=`echo $line | awk '{ $1=""; print $0 }'`
count=`echo $orig_line | awk '{ print $1 }'`
name=`echo $orig_line | awk '{
for (i=2; i<=NF-1; i++) {
if (i>2) printf(" ")
printf("%s", $i)
}
}'`
email=`echo $orig_line | awk '{ print $NF }'`
# don't show known aliases
for alias in "${aliases[@]}"; do
if [ "$name" = "$alias" ]; then
continue 2
fi
if [ "$email" = "$alias" ]; then
continue 2
fi
done
grep -q "$email" CONTRIBUTORS.rst
if [ $? -ne 0 ]; then
printf "%3d %25s %s\n" $count "$name" "$email"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment