commit-calculator/git-log2json.sh

11 lines
316 B
Bash
Executable File

#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--date=iso \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'