-
Notifications
You must be signed in to change notification settings - Fork 13
/
.cal.sh
executable file
·42 lines (37 loc) · 1.03 KB
/
.cal.sh
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
37
38
39
40
41
#!/usr/bin/env bash
git=`which git`
while read -ra Z; do
if [[ "${Z[@]}" == \*\ * ]]; then
gbranch="${Z[1]}"
break
fi
done <<< "$($git branch 2> /dev/null)"
((cno=0))
while read -r Z; do
[[ "$Z" == commit* ]] && ((cno+=1))
done <<< "$($git log 2> /dev/null)"
$git rev-list --left-right --count origin/main..."$gbranch" >/dev/null 2>&1
if [ "$?" == 0 ];then
rev=`$git rev-list --left-right --count origin/main..."$gbranch"`;
beh=$(cut -f1 <<< $rev )
ahe=$(cut -f2 <<< $rev )
echo -e "$($git diff --cached --name-only | wc -l)"\
"$($git diff --stat origin/main.. | wc -l)"\
"$($git diff --name-status | wc -l)"\
"$($git ls-files --others --exclude-standard | wc -l)"\
"$gbranch"\
"${cno}"\
"$beh"\
"$ahe"
else
beh="-1"
ahe="-1"
echo -e "$($git diff --cached --name-only | wc -l)"\
"0"\
"$($git diff --name-status | wc -l)"\
"$($git ls-files --others --exclude-standard | wc -l)"\
"$gbranch"\
"${cno}"\
"$beh"\
"$ahe"
fi