stagit

Fork of `stagit` for git.knutsen.co.
git clone git://git.knutsen.co/stagit
Log | Files | Refs | README | LICENSE

commit dee83b1f1087f9f56114741c6dff52a01ed0d7cb
parent 467dfeb8f4bf2dd1ddb69e5c9592147acb425aab
Author: sfdk <samuel@knutsen.co>
Date:   Wed,  1 Jul 2020 15:26:18 +0000

Initial changes.

Diffstat:
Mlogo.png | 0
Arepo-gen.sh | 27+++++++++++++++++++++++++++
Mstagit.c | 8+++++---
3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/logo.png b/logo.png Binary files differ. diff --git a/repo-gen.sh b/repo-gen.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +fresh=false + +for arg in "$@"; do + [ "$arg" = "--fresh" ] && fresh=true +done + +for repo in /srv/git/*.git; do + repo="$(basename "$repo" | cut -f 1 -d '.')" + + [ "$fresh" = true ] \ + && echo "Deleting HTML for $repo." \ + && rm -fr "/var/www/git/$repo" + mkdir -p "/var/www/git/$repo" + cd "/var/www/git/$repo" + + [ ! -f style.css ] && ln -s ../style.css ./ + [ ! -f favicon.png ] && ln -s ../favicon.png ./ + [ ! -f logo.png ] && ln -s ../logo.png ./ + + echo "git://git.knutsen.co/$repo" > "/srv/git/$repo.git/url" + + stagit "/srv/git/$repo.git" +done + +stagit-index /srv/git/*.git > /var/www/git/index.html diff --git a/stagit.c b/stagit.c @@ -365,11 +365,11 @@ writeheader(FILE *fp, const char *title) xmlencode(fp, description, strlen(description)); fputs("</span></td></tr>", fp); if (cloneurl[0]) { - fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp); + fputs("<tr class=\"url\"><td></td><td><span class=\"clone\">git clone <a href=\"", fp); xmlencode(fp, cloneurl, strlen(cloneurl)); fputs("\">", fp); xmlencode(fp, cloneurl, strlen(cloneurl)); - fputs("</a></td></tr>", fp); + fputs("</a></span></td></tr>", fp); } fputs("<tr><td></td><td>\n", fp); fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath); @@ -397,7 +397,7 @@ int writeblobhtml(FILE *fp, const git_blob *blob) { size_t n = 0, i, prev; - const char *nfmt = "<a href=\"#l%d\" class=\"line\" id=\"l%d\">%7d</a> "; + const char *nfmt = "<a href=\"#l%d\" class=\"line\" id=\"l%d\">%7d</a><span class=\"loc\">"; const char *s = git_blob_rawcontent(blob); git_off_t len = git_blob_rawsize(blob); @@ -410,6 +410,7 @@ writeblobhtml(FILE *fp, const git_blob *blob) n++; fprintf(fp, nfmt, n, n, n); xmlencode(fp, &s[prev], i - prev + 1); + fprintf(fp, "</span>"); prev = i + 1; } /* trailing data */ @@ -417,6 +418,7 @@ writeblobhtml(FILE *fp, const git_blob *blob) n++; fprintf(fp, nfmt, n, n, n); xmlencode(fp, &s[prev], len - prev); + fprintf(fp, "</span>"); } }