From c472d2bdd7a248847101c8ddbca6d030c04ad097 Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Sat, 21 Jan 2023 18:11:27 +0100 Subject: [PATCH] chore: exclude merge commits when counting user commits --- count-commits.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/count-commits.sh b/count-commits.sh index 7389152..f254b9e 100755 --- a/count-commits.sh +++ b/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///' | 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 -