From 591b0e17391c69e67e4ae7846b3810132ab026ad Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 4 Nov 2018 16:59:50 +0100 Subject: [PATCH] count-contributions.sh: add script to count number of commits Signed-off-by: Jo-Philipp Wich --- count-contributions.sh | 49 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 count-contributions.sh diff --git a/count-contributions.sh b/count-contributions.sh new file mode 100755 index 0000000..47bf2e0 --- /dev/null +++ b/count-contributions.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +commit_threshold=100 +commit_timeframe="$(date --date="5 years ago" +%Y-%m-%d)" + +NL=" +" + +IFS="$NL" +ACTIVE_PEOPLE="" + + +printf "### Recently active contributors:\n" +printf "[Active period begin-end] Commits (Alltime) Name \n" + +for line in $(git log --since $commit_timeframe --format="|%aN <%aE>" | sort | uniq -c | sort -nr); do + count="${line%% |*}"; count="${count##* }" + name="${line#* |}" + + if [ $count -lt $commit_threshold ]; then + continue + fi + + ACTIVE_PEOPLE="$ACTIVE_PEOPLE$name$NL" + + alltime="$(git log --use-mailmap --author="$name" --format="%aN" | wc -l)" + begin="$(git log --use-mailmap --author="$name" --format="%cd" --date="format:%Y-%m-%d" --reverse | head -n1)" + end="$(git log --use-mailmap --author="$name" --format="%cd" --date="format:%Y-%m-%d" -1)" + + printf "[%s - %s] %5d (%5d) %s\n" $begin $end $count $alltime "$name" +done + +printf "\n" +printf "### Important all-time contributors:\n" +printf "[Active period begin-end] Commits Name \n" + +for line in $(git log --format="|%aN <%aE>" | sort | uniq -c | sort -nr); do + count="${line%% |*}"; count="${count##* }" + name="${line#* |}" + + if [ $count -lt $commit_threshold ] || echo "$ACTIVE_PEOPLE" | grep -qxF "$name"; then + continue + fi + + begin="$(git log --use-mailmap --author="$name" --format="%cd" --date="format:%Y-%m-%d" --reverse | head -n1)" + end="$(git log --use-mailmap --author="$name" --format="%cd" --date="format:%Y-%m-%d" -1)" + + printf "[%s - %s] %5d %s\n" $begin $end $count "$name" +done -- 2.30.2