commit a353d0d23b18f10680c3053c8e9f1e1206576263 parent 2eabed85b935f0f5110c6834bffcb4672078aa05 Author: Cem Keylan <cem@ckyln.com> Date: Thu, 13 Aug 2020 13:49:31 +0300 post-receive: better check for file names, link to log if this fails. Diffstat:
M | post-receive | | | 13 | ++++++++++--- |
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/post-receive b/post-receive @@ -53,9 +53,16 @@ for file in style.css logo.png favicon.png; do [ -f "../$file" ] && ln -sf "../$file" "$file" done -# Link index.html to log.html so users don't have to -# type the whole file out. -ln -sf file/README*.html index.html +# If a README file exists, link the index to the README. If it doesn't, link the +# index to the repository log. +rm -f index.html +for file in file/*.html; do + [ -f "$file" ] || continue + case "${file##*/}" in README*) + ln -sf "$file" index.html + esac +done +[ -f index.html ] || ln -sf log.html index.html )