]> git.armaanb.net Git - stagit.git/blobdiff - example.sh
reduce scope of repodir, remove unused branch parameter
[stagit.git] / example.sh
index 1765047c6351c8c03b7e419c8b95a7ac28d63e9f..84ccffd67eb3b5eff092fe05fb691e1f24b22449 100644 (file)
 # - mkdir -p htmldir && cd htmldir
 # - sh example.sh
 
+# path must be absolute.
 reposdir="/var/www/domains/git.codemadness.nl/home/src"
 curdir=$(pwd)
 
 # make index.
-cd "${reposdir}"
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index |
-        sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
-        sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index.html"
-
-# make index (sort by last commit author time).
-find . -maxdepth 1 -type d | grep -v "^.$" | while read -r dir; do
-       d=$(basename "${dir}")
-       cd "${reposdir}/${d}"
-       timestamp=$(git show -s --pretty="format:%at" || true)
-
-       printf "%d %s\n" "${timestamp}" "${d}"
-done | sort -n -k 1 | cut -f 2- -d ' ' | xargs stagit-index | \
-       sed 's@<td>Last commit</td>@<td><a href="index-time.html">Last commit</a></td>@g' | \
-       sed 's@<td>Name</td>@<td><a href="index.html">Name</a></td>@g' > "${curdir}/index-time.html"
+stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
 
 # make files per repo.
-cd "${reposdir}"
-find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
-       d=$(basename "${dir}")
-       printf "%s..." "${d}"
+for dir in "${reposdir}/"*/; do
+       # strip .git suffix.
+       r=$(basename "${dir}")
+       d=$(basename "${dir}" ".git")
+       printf "%s... " "${d}"
 
        mkdir -p "${curdir}/${d}"
        cd "${curdir}/${d}"
-       stagit "${reposdir}/${d}"
+       stagit -c ".cache" "${reposdir}/${r}"
 
        # symlinks
        ln -sf log.html index.html
@@ -48,5 +36,5 @@ find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do
        ln -sf ../logo.png logo.png
        ln -sf ../favicon.png favicon.png
 
-       printf " done\n"
+       printf "done\n"
 done