ga-infounused: Use `--no-textconv` in `git diff`
[sunny256-utils.git] / git-plot
blobd5ad56d041578e37be9b7369b7ca6bdb14471c89
1 #!/usr/bin/env bash
3 #=======================================================================
4 # git-plot
5 # File ID: 815ee2b8-c99a-11e2-b66c-001f3b596ec9
6 # Plot a curve to show the Git commit activity
7 # License: GNU General Public License version 2 or later.
8 #=======================================================================
10 if test "$1" = "-2"; then
11 shift
12 tmpname=$(date +"%s").$$
13 authorfile=/tmp/git-plot.$(date +"%s").$$.author.tmp
14 commitfile=/tmp/git-plot.$(date +"%s").$$.commit.tmp
15 git log --pretty="%at" "$@" | sort -n | inc_epstat >$authorfile
16 git log --pretty="%ct" "$@" | sort -n | inc_epstat >$commitfile
17 cat <<END | gnuplot --persist
18 #!/usr/bin/gnuplot --persist
20 set xdata time
21 set grid
22 set timefmt "%s"
23 set format x "%Y-%m-%d %H:%M:%S"
24 set yrange [0.1:]
25 set linetype 1 lc rgb "blue"
26 set linetype 2 lc rgb "red"
27 set linetype 3 lw 2 lc rgb "blue"
28 set linetype 4 lw 2 lc rgb "red"
29 plot "$commitfile" using 1:2 title "commit" w l lt 2, \
30 "$authorfile" using 1:2 title "author" w l lt 1, \
31 "$commitfile" using 1:2 title "bezier commit" s b w l lt 4, \
32 "$authorfile" using 1:2 title "bezier author" s b w l lt 3
33 END
34 else
35 tmpfile=/tmp/git-plot.$(date +"%s").$$.tmp
36 git log --pretty="%ct" "$@" | ep | sort | inc_epstat >$tmpfile
37 stpl -lp $tmpfile