From 7b4417673fe766a4264db404d1830f692afa7d9b Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Mon, 16 Jan 2023 22:57:10 +0100 Subject: [PATCH 1/3] chore: add count commit script --- count-commits.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 count-commits.sh diff --git a/count-commits.sh b/count-commits.sh new file mode 100755 index 0000000..ee0657c --- /dev/null +++ b/count-commits.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +total_commits=$(git shortlog -s -n | 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 From 1e3ce85d043f34cb65f5e0f6b09c62464e57402a Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Mon, 16 Jan 2023 23:06:00 +0100 Subject: [PATCH 2/3] chore: add user commits to count commit script --- count-commits.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/count-commits.sh b/count-commits.sh index ee0657c..1997abb 100755 --- a/count-commits.sh +++ b/count-commits.sh @@ -7,3 +7,6 @@ if [[ $total_commits -gt 200 ]]; then else echo "Total commits: $total_commits. $(expr 200 - $total_commits) commits left to reach minimum required commits" fi + +echo "Commits per user:" +git shortlog -s -e | sed 's///' | awk '{ printf "\t%s (%s): %s\n", $2, $3, $1 }' From ef17e7ab11508d86f76bcd46e0f4a828cefb446f Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Mon, 16 Jan 2023 23:08:41 +0100 Subject: [PATCH 3/3] refactoring: change count commit script total commits output --- count-commits.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/count-commits.sh b/count-commits.sh index 1997abb..949ec77 100755 --- a/count-commits.sh +++ b/count-commits.sh @@ -3,9 +3,9 @@ total_commits=$(git shortlog -s -n | awk '{ sum += $1; } END { print sum; }' "$@") if [[ $total_commits -gt 200 ]]; then - echo "Total commits: $total_commits. Minimum required commits reached!" + 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" + echo "Total commits: $total_commits ($(expr 200 - $total_commits) commits left to reach minimum required commits)" fi echo "Commits per user:"