dot

packages and services management
Log | Files | Refs | README

commit 6b376d59799a9c8497953f55d473470d9eb4f7e9
parent efffc8f9f932a1b853697523079672e313430466
Author: Josuah Demangeon <mail@josuah.net>
Date:   Fri, 17 Nov 2017 17:46:53 +0100

simpler script

Diffstat:
Mbin/git-index | 39++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/bin/git-index b/bin/git-index @@ -1,24 +1,25 @@ #!/bin/sh # add index.html and commit/%H.html inside of a git bare repository - #git #pree + +export LC_COLLATE=C NAME=$(cd "$1" && pwd | sed 's|.*/||') -HEADER='<!doctype html> -<title>'$NAME'</title> + +HEADER="<!doctype html> +<title>$NAME</title> <meta charset="utf-8"/> -<style> pre { float: left; margin: 4em 0 4em 4em; } </style> +<style> pre { width: 80ch; margin: 4em auto 4em auto; } </style> <pre> -<h1><a href="..">&lt;</a> '$NAME'</h1> -$ GIT_SMART_HTTP=0 git clone '$NAME'' - -export LC_COLLATE=C +<h1><a href="..">&lt;</a> $NAME</h1> +GIT_SMART_HTTP=0 git clone http://git.josuah.net/$NAME +" { - printf '%s\n' "$HEADER" - git -C "$1" ls-tree -r --name-only master | sort | pree - printf '</pre><pre>\n' - git -C "$1" log --date=short --graph \ - --format='%H %cd %cn <%ce>%n%s%n' | + printf '%s\n\n' "$HEADER" + git -C "$1" ls-tree -r --name-only master | sort | sed 's|^|./|' + printf '\n\n' + git -C "$1" log --graph --date=short --decorate --tags --stat \ + --branches --remotes | sed -r -e 's|&|\&amp;|g' \ -e 's|<|\&lt;|g' \ -e 's|([0-9a-f]{8})[0-9a-f]{32}|<a href="commit/&.html">\1</a>|' @@ -32,13 +33,13 @@ do printf '%s\n' "$commit" printf '%s\n' "$HEADER" > "$1/commit/$commit.html" git -C "$1" show -U3 "$commit" | sed >> "$1/commit/$commit.html" \ - -e 's|&|\&amp;|g' \ - -e 's|<|\&lt;|g' \ - -e 's|^[A-Z][a-z]*:|<b>&</b>|' \ + -e ' s|&|\&amp;|g' \ + -e ' s|<|\&lt;|g' \ + -e ' s|^[A-Z][a-z]*:|<b>&</b>|' \ -e '/^commit/ s|.*|<b>&</b>|' \ -e '/^diff/ s|.*|<b>&</b>|' \ - -e '/^+/ s|.*|<span style="color: green;">&</span>|' \ - -e '/^-/ s|.*|<span style="color: red ;">&</span>|' \ - -e '/^@/ s|.*|<span style="color: blue ;">&</span>|' + -e '/^+/ s|.*|<span style="color: #0f0;">&</span>|' \ + -e '/^-/ s|.*|<span style="color: #f00;">&</span>|' \ + -e '/^@/ s|.*|<span style="color: #00f;">&</span>|' printf '</pre>\n' >> "$1/commit/$commit.html" done