example.sh: add index-time.html, list sorted by time, fix reposdir '/'
1 files changed, 16 insertions(+), 4 deletions(-) | |||
---|---|---|---|
M | example.sh | +16 | -4 |
1@@ -14,16 +14,28 @@
2
3 set -e
4
5-reposdir="/var/www/domains/git.codemadness.nl/home/src/"
6+reposdir="/var/www/domains/git.codemadness.nl/home/src"
7 curdir=$(pwd)
8
9 # make index.
10 cd "${reposdir}"
11-find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index > "${curdir}/index.html"
12+find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index |
13+ sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
14+ sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index.html"
15+
16+# make index (sort by last commit author time).
17+find . -maxdepth 1 -type d | grep -v "^.$" | while read -r dir; do
18+ d=$(basename "${dir}")
19+ cd "${reposdir}/${d}"
20+ timestamp=$(git show -s --pretty="format:%at" || true)
21+
22+ printf "%d %s\n" "${timestamp}" "${d}"
23+done | sort -n -k 1 | cut -f 2- -d ' ' | xargs stagit-index | \
24+ sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
25+ sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index-time.html"
26
27 # make files per repo.
28 find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
29- cd "${reposdir}"
30 d=$(basename "${dir}")
31
32 printf "%s..." "${d}"
33@@ -31,7 +43,7 @@ find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
34
35 test -d "${d}" || mkdir -p "${d}"
36 cd "${d}"
37- stagit "${reposdir}${d}"
38+ stagit "${reposdir}/${d}"
39
40 printf " done\n"
41