From f0888c835d830e69526603c44128d9ee44e67333 Mon Sep 17 00:00:00 2001 From: varac Date: Wed, 31 May 2017 23:15:31 +0200 Subject: Finish get_contributors.sh --- get_contributors.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'get_contributors.sh') diff --git a/get_contributors.sh b/get_contributors.sh index 49ed580..eaae0d0 100755 --- a/get_contributors.sh +++ b/get_contributors.sh @@ -9,30 +9,31 @@ REPOS=(bitmask_android bitmask_bundler bitmask_client bitmask-dev bitmask_help b # shellcheck disable=SC2016 GET_CONTRIBUTORS='git log --branches --not --remotes=subrepo --use-mailmap --format="%aN <%aE>" | awk "{arr[\$0]++} END{for (i in arr){print arr[i], i;}}" | sort -rn | cut -d" " -f2- | sort' ROOTDIR="${HOME}/leap/git" -LISTFILE='/tmp/contributors.txt' # optional specify core team memebers to filter out TEAM='(email@of.contributor.org|email@of_other_contributor.net)' -[ -e ${LISTFILE} ] && rm ${LISTFILE} -[ -e ${LISTFILE}.tmp ] && rm ${LISTFILE}.tmp +declare -A contributors for repo in "${REPOS[@]}" do cd "${ROOTDIR}/${repo}" || exit 1 # Uncomment for first run to make sure all repos are up to date # git fetch - contributors=$(eval "$GET_CONTRIBUTORS" | egrep --text -iv "$TEAM") - if [ -n "$contributors" ] + contributors_repo=$(eval "$GET_CONTRIBUTORS" | egrep --text -iv "$TEAM") + if [ -n "$contributors_repo" ] then echo "${repo}:" - echo "$contributors" | tee -a ${LISTFILE}.tmp + while read -r line; do + echo "$line" + contributors["$line"]+="$repo, " + done <<< "$contributors_repo" echo echo fi done +echo +echo -sort < "${LISTFILE}.tmp" | uniq > "${LISTFILE}" -rm "${LISTFILE}.tmp" -echo "Complete list of contributors is at ${LISTFILE}" +for contributor in "${!contributors[@]}"; do echo "$contributor: ${contributors[$contributor]}"; done | sort -- cgit v1.2.3