From fd66a29d3ab2f226bc457cb4b3db63da8dff6bf0 Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Fri, 8 Jan 2016 13:39:23 +0100 Subject: [PATCH] example.sh: add index-time.html, list sorted by time, fix reposdir '/' --- example.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/example.sh b/example.sh index 1824dc3..385283d 100644 --- a/example.sh +++ b/example.sh @@ -14,16 +14,28 @@ set -e -reposdir="/var/www/domains/git.codemadness.nl/home/src/" +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 > "${curdir}/index.html" +find . -maxdepth 1 -type d | grep -v "^.$" | sort | xargs stagit-index | + sed 's@Last commit@Last commit@g' | \ + sed 's@Name@Name@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@Last commit@Last commit@g' | \ + sed 's@Name@Name@g' > "${curdir}/index-time.html" # make files per repo. find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do - cd "${reposdir}" d=$(basename "${dir}") printf "%s..." "${d}" @@ -31,7 +43,7 @@ find . -maxdepth 1 -type d | grep -v "^.$" | sort | while read -r dir; do test -d "${d}" || mkdir -p "${d}" cd "${d}" - stagit "${reposdir}${d}" + stagit "${reposdir}/${d}" printf " done\n" -- libgit2 1.1.1