Browse Source

chore: exclude merge commits when counting user commits

main
fdai7451 2 years ago
parent
commit
d7312043d7
  1. 3
      count-commits.sh

3
count-commits.sh

@ -12,7 +12,7 @@ echo "Total commits: $(git shortlog -s -n --no-merges | awk '{ sum += $1; } END
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 }')
total_commits=$(git shortlog -s --no-merges --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 }')
@ -32,4 +32,3 @@ for user in $(git shortlog -s | awk '{ print $2 }'); do
echo -e "\t$user ($email): Total $total_commits, Tests: $test_commits ($test_percentage%), Refactorings: $refactor_commits ($refactor_percentage%)"
done
Loading…
Cancel
Save