-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
repo-stats.sh
executable file
·38 lines (25 loc) · 1.06 KB
/
repo-stats.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
#!/usr/bin/env bash
echo -e "commit,date,loc_total,loc_code,loc_comments,text,bss,dec,bin" > target/sizes.csv
trap 'echo -e "\nCancelled. Restoring repo."; git checkout --quiet --force master; exit' INT
for commit in $(git rev-list master)
do
date=$(git show -s --format=%ci $commit)
echo "Commit ${commit} at ${date}"
git checkout $commit --quiet
if [[ -f "examples/embassy-stm32/Cargo.toml" ]]; then
pushd examples/embassy-stm32 > /dev/null
out=$(cargo size --release --quiet | tail -n1)
text=$(echo $out | awk '{print $1}')
bss=$(echo $out | awk '{print $3}')
dec=$(echo $out | awk '{print $4}')
cargo objcopy --release --quiet -- -O binary target/size.bin
out=$(wc -c target/size.bin)
bin=$(echo $out | awk '{print $1}')
popd > /dev/null
fi
code_stats=$(tokei --type Rust | tail -n2 | head -n1 | awk '{print $3","$4","$5}')
echo -n "--> "
echo -e "$commit,$date,$code_stats,$text,$bss,$dec,$bin" | tee -a target/sizes.csv
done
echo "Done"
git checkout master --quiet