-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-lines-per-author-in-unmerged-branches
executable file
·36 lines (29 loc) · 1.36 KB
/
git-lines-per-author-in-unmerged-branches
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/bash
trunk=$1
if [ -z "${trunk}" ] ; then
echo "usage: $0 <trunk>"
exit 1
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# readarray -t revs <<< "$(git log --format="%H" "$(git merge-base "${trunk}" "${branch}")".."${branch}")"
# for rev in "${revs[@]}" ; do
# IFS=": " read -r author count <<< "$("${SCRIPT_DIR}"/git-lines-per-author-in-commit "${rev}")"
# echo "${author} ${count}"
# done
# 1417 2023-05-29 11:29:24 readarray -t branches <<< "$(~/devl/bash/git/git-unmerged-branches-no-on-remote master)"
# 1418 2023-05-29 11:31:41 for branch in "${branches[@]}" ; do counts="$(~/devl/bash/git/git-lines-per-author-in-branch master "${branch}")"; echo "${branch}"; for cnt in "${counts[@]}" ; do echo " " "${cnt}"; done done
readarray -t branches <<< "$(git branch | sed 's/. \(.*\)/\1/g' | sed 's/remotes\/origin\/\(.*\)/\1/g' | awk 'NF > 0' | awk '!seen[$0]++' | sort)"
# declare -A unmerged
for b in "${branches[@]}" ; do
behind="$("${SCRIPT_DIR}"/git-behind "${trunk}" "${b}")"
ahead="$("${SCRIPT_DIR}"/git-ahead "${trunk}" "${b}")"
if [ "${ahead}" == 0 ] ; then
continue
fi
readarray -t counts <<< "$("${SCRIPT_DIR}"/git-lines-per-author-in-branch "${trunk}" "${b}")"
echo "${b} is ${behind}:${ahead} behind:ahead of ${trunk}"
for count in "${counts[@]}" ; do
echo " ${count}"
done
echo ""
done