Last active
June 18, 2016 22:49
-
-
Save bewest/85ff1a8cb76ece1a8d0369361d854328 to your computer and use it in GitHub Desktop.
mk-time-series from openaps git logs
This file contains hidden or 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 | |
# oref0-predict/oref0.json | |
INPUT=$1 | |
TEST_EXEC="if (Array.isArray(this)) { process.exit(1); }" | |
git log \ | |
--format="format:%h %aI %s" \ | |
-n 100 --follow -- $INPUT \ | |
| while read hash iso subject ; do | |
spec=$hash:$INPUT | |
git show $spec \ | |
| ( json -A -e "$TEST_EXEC" || ( echo "{}" \ | |
| json -0 -e "this.slice = $(git show $spec )" | |
) ) 2>/dev/null \ | |
| json -0 -e "this.dateString = '$iso'" \ | |
| json -0 -e "this.subject = '$subject'" \ | |
| json -0 -e "this.hash = '$hash'" | |
done | json -ga -0 | json -g | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment