Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
export_diff() {
declare project=$1 period=$2 hash=$3
local person="$(git -C "$project" show --format="%an" -s "$hash")"
local target="output/$period/$person/${project#projects/}/$hash.html"
mkdir -p "$(dirname "$target")"
git -C "$project" show "$hash" | ./node_modules/.bin/diff2html --input stdin --file "$target"
export_project_for_period() {
declare project=$1 sice=$2 until=$3
echo " -> period $since -- $until"
git -C "$project" log --format='%H' --since "$since" --until "$until" | while read hash ; do
export_diff "$project" "$since" "$hash"
export_project() {
declare project=$1
echo "Exporting $project"
while read since until; do
export_project_for_period "$project" "$since" "$until"
done <<-EOF
2015-09-01 2015-09-30
2016-09-01 2016-09-30
2017-09-01 2017-09-30
main() {
for name in projects/*; do
export_project "$name"
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment