-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.sh
More file actions
executable file
·22 lines (21 loc) · 961 Bytes
/
Copy pathstats.sh
File metadata and controls
executable file
·22 lines (21 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
authors=$(git log --format='%aN' | sort -u)
for author in $authors; do
echo "Statistiques pour l'auteur : $author"
commits=$(git log --author="$author" --oneline --format='%H')
total_added=0
total_deleted=0
total_modified=0
for commit in $commits; do
stats=$(git show --pretty=format: --numstat $commit)
added=$(echo "$stats" | awk '{s+=$1} END {print s}')
deleted=$(echo "$stats" | awk '{s+=$2} END {print s}')
modified=$(echo "$stats" | awk '{s+=$1+$2} END {print s}')
echo "Commit $commit : Ajoutées = $added, Supprimées = $deleted, Modifiées = $modified"
total_added=$((total_added + added))
total_deleted=$((total_deleted + deleted))
total_modified=$((total_modified + modified))
done
echo "Total pour $author : Ajoutées = $total_added, Supprimées = $total_deleted, Modifiées = $total_modified"
echo "-----------------------------"
done