Added diff count
This commit is contained in:
26
gitistics.sh
26
gitistics.sh
@@ -14,8 +14,14 @@ STARTDATE="01 Jan 2018"
|
|||||||
# Switch into the REPODIR
|
# Switch into the REPODIR
|
||||||
pushd $REPODIR
|
pushd $REPODIR
|
||||||
|
|
||||||
|
# total commits
|
||||||
commitcounter=0
|
commitcounter=0
|
||||||
|
|
||||||
|
# total diff stats
|
||||||
|
totalfiles=0
|
||||||
|
totalinsertions=0
|
||||||
|
totaldeletions=0
|
||||||
|
|
||||||
# Iterate over all subdirectories
|
# Iterate over all subdirectories
|
||||||
for dir in $REPODIR/*/
|
for dir in $REPODIR/*/
|
||||||
do
|
do
|
||||||
@@ -25,11 +31,28 @@ do
|
|||||||
# enter directory
|
# enter directory
|
||||||
cd ${dir##*/}
|
cd ${dir##*/}
|
||||||
|
|
||||||
|
# --- RUN COMMANDS
|
||||||
|
|
||||||
# show amount of commits of all users
|
# show amount of commits of all users
|
||||||
committemp=$(git rev-list --count --all --author=$REPOUSER --since="$STARTDATE")
|
committemp=$(git rev-list --count --all --author=$REPOUSER --since="$STARTDATE")
|
||||||
|
|
||||||
|
# Add to the total commit counter
|
||||||
commitcounter=$((commitcounter + committemp))
|
commitcounter=$((commitcounter + committemp))
|
||||||
|
|
||||||
|
|
||||||
|
# calculate total changes between given date and HEAD
|
||||||
|
extractdiff=$(git diff @{"$STARTDATE"} HEAD --shortstat) 2>/dev/null
|
||||||
|
|
||||||
|
# set the separator to ,
|
||||||
|
IFS=','
|
||||||
|
array=( $extractdiff )
|
||||||
|
totalfiles=$(( ${array[0]//[!0-9]} + totalfiles))
|
||||||
|
totalinsertions=$(( ${array[1]//[!0-9]} + totalinsertions))
|
||||||
|
totaldeletions=$(( ${array[2]//[!0-9]} + totaldeletions))
|
||||||
|
|
||||||
|
|
||||||
|
# ------------------
|
||||||
|
# Output the commit counter of the current iteration
|
||||||
echo $committemp
|
echo $committemp
|
||||||
|
|
||||||
# go back
|
# go back
|
||||||
@@ -37,6 +60,9 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Total commits since $STARTDATE: $commitcounter"
|
echo "Total commits since $STARTDATE: $commitcounter"
|
||||||
|
echo "Total files changed: $totalfiles"
|
||||||
|
echo "Total insertions: $totalinsertions"
|
||||||
|
echo "Total deletions: $totaldeletions"
|
||||||
|
|
||||||
# Switch back to the original directory state
|
# Switch back to the original directory state
|
||||||
popd
|
popd
|
||||||
|
Reference in New Issue
Block a user