forked from MohamedSabthar/Smart-Cargo-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript1.sh
More file actions
executable file
·19 lines (18 loc) · 836 Bytes
/
script1.sh
File metadata and controls
executable file
·19 lines (18 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
from="1 Jun, 2020"
to="17 Aug, 2020"
users=$(git shortlog -sn --no-merges --since="$from" --before="$to" | awk '{printf "%s %s\n", $2, $3}')
IFS=$'\n'
echo -e "User name;Files changed;Lines added;Lines deleted;Total lines (delta);Add./Del. ratio (1:n);Commit count"
for userName in $users
do
result=$(git log --author="$userName" --no-merges --shortstat --since="$from" --before="$to" \
| grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} \
END {printf "%s;%s;%s;%s;%s", files, inserted, deleted, delta, ratio }' -)
countCommits=$(git shortlog -sn --no-merges --since="$from" --before="$to" --author="$userName" \
| awk '{print $1}')
if [[ ${result} != ';;;;' ]]
then
echo -e "$userName;$result;$countCommits"
fi
done