Created
June 8, 2019 00:17
-
-
Save friendoye/e5c81282dbdbf857eb43633a55ca6253 to your computer and use it in GitHub Desktop.
Small util for analyze .git diff between commits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
comm1="release/v1.0" | |
comm2="release/v0.7" | |
working_dir="Android/insta" | |
report_file="report.txt" | |
# TODO: Add more information about diff: | |
# 1) APK size | |
# 2) Build time (cold running) | |
# 3) Amount of commits in between | |
# 4) Sum cloc reports in fetch_report_for_commit() | |
# 5) Brand new files / completely removed files | |
# 6) Provide top config via args | |
fetch_report_for_commit () { | |
git checkout $1 > /dev/null 2>&1 | |
echo "Gathering info from commit $1 ..." | |
echo -e "\nStats for commit $1:" >> $2 | |
echo -e "Info about XML layouts:" >> $2 | |
cloc . --by-percent cmb \ | |
--include-lang=XML \ | |
--exclude-dir=build \ | |
--match-d="res\/(layout).*" \ | |
--skip-uniqueness \ | |
--quiet | sed '/github/,$!d' | sed -n '1!p' >> $2 | |
echo -e "Info about Kotlin codebase:" >> $2 | |
cloc . --by-percent cmb \ | |
--include-lang=Kotlin,Java \ | |
--exclude-dir=build . \ | |
--quiet | sed '/github/,$!d' | sed -n '1!p' >> $2 | |
} | |
cd $working_dir | |
echo "Gathering diff between $comm1 and $comm2 ..." | |
echo -e "Diffing:" > $report_file | |
git diff --stat $comm1 $comm2 >> $report_file | |
cloc --git --diff \ | |
--by-percent cmb \ | |
--include-lang=XML,Kotlin,Java \ | |
--exclude-dir=build $comm1 $comm2 \ | |
--sum-one \ | |
| sed '/github/,$!d' | sed -n '1!p' >> $report_file | |
echo -e "\n\n" >> $report_file | |
fetch_report_for_commit $comm1 $report_file | |
echo -e "\n\n" >> $report_file | |
fetch_report_for_commit $comm2 $report_file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment