summaryrefslogtreecommitdiff
path: root/log.sh
blob: ded6275925b024ae39c4d9537c98d7bc5afc83df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh

template=${1:-index.html.in}

function dump_latest_changes () {
	git-rev-list  --max-count=10 --pretty HEAD |
	while read line; do
	    case $line in
		Date:*)
		    d=${line/??:??:??}	# Strip time
		    d=${d/Date:};	# Strip Date: prefix
		    d=${d/[+-]????}	# Strip timezone
		    if test "$d" != "$date"; then
			test "$date" && echo "</ul>"
			echo -e "<h2>$d</h2>\n<ul>"
		    fi
		    date=$d;;
		commit*);;
		Author*);;
		?*)
		    echo "<li>$line";;
	    esac
	done
	echo "</ul>"
}

cat $template |
while read t; do
    case $t in
	"@LATEST_CHANGES@"*)
	    dump_latest_changes;;
	*)
	    echo $t;;
    esac
done