You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.3 KiB
34 lines
1.3 KiB
#!/bin/bash
|
|
|
|
total_commits=$(git shortlog -s -n --no-merges | awk '{ sum += $1; } END { print sum; }' "$@")
|
|
|
|
if [[ $total_commits -gt 200 ]]; then
|
|
echo "Total commits: $total_commits (minimum required commits reached)"
|
|
else
|
|
echo "Total commits: $total_commits ($(expr 200 - $total_commits) commits left to reach minimum required commits)"
|
|
fi
|
|
|
|
echo "Commits per user:"
|
|
for user in $(git shortlog -s | awk '{ print $2 }'); do
|
|
email=$(git shortlog -s -e --author="$user" | sed 's/<//;s/>//' | awk '{ print $3 }')
|
|
total_commits=$(git shortlog -s --perl-regexp --author="$user" | awk '{ print $1 }')
|
|
test_commits=$(git shortlog -s --perl-regexp --author="$user" --grep='^test:' | awk '{ print $1 }')
|
|
refactor_commits=$(git shortlog -s --perl-regexp --author="$user" --grep='^refactoring:' | awk '{ print $1 }')
|
|
|
|
if [[ $test_commits -eq 0 ]]; then
|
|
test_commits=0
|
|
test_percentage=0
|
|
else
|
|
test_percentage=$(echo "$test_commits/$total_commits*100" | bc -l | xargs printf "%.2f")
|
|
fi
|
|
|
|
if [[ $refactor_commits -eq 0 ]]; then
|
|
refactor_commits=0
|
|
refactor_percentage=0
|
|
else
|
|
refactor_percentage=$(echo "$refactor_commits/$total_commits*100" | bc -l | xargs printf "%.2f")
|
|
fi
|
|
|
|
echo -e "\t$user ($email): Total $total_commits, Tests: $test_commits ($test_percentage%), Refactorings: $refactor_commits ($refactor_percentage%)"
|
|
done
|
|
|