stagit

stagit fork for git.lleb.me
git clone git://git.lleb.me/stagit
Log | Files | Refs | README | LICENSE

commit d25a87556342e952d5eea791b4c8f7f8f28dc0f0
parent 467dfeb8f4bf2dd1ddb69e5c9592147acb425aab
Author: root <root@debian-s-1vcpu-2gb-sfo2-01>
Date:   Sun, 12 Jul 2020 02:40:49 -0700

removed owner column; changed page name

Diffstat:
A#example_post-receive.sh# | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A.gitignore | 2++
Apost-recieve-sys9wm.sh | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Apost-recieve~ | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Areallocarray.o | 0
Astagit | 0
Astagit-index | 0
Mstagit-index.c | 13+++++++------
Astagit-index.o | 0
Astagit.o | 0
Astrlcat.o | 0
Astrlcpy.o | 0
12 files changed, 228 insertions(+), 6 deletions(-)

diff --git a/#example_post-receive.sh# b/#example_post-receive.sh# @@ -0,0 +1,73 @@ +#!/bin/sh +# generic git post-receive hook. +# change the config options below and call this script in your post-receive +# hook or symlink it. +# +# usage: $0 [name] +# +# if name is not set the basename of the current directory is used, +# this is the directory of the repo when called from the post-receive script. + +# NOTE: needs to be set for correct locale (expects UTF-8) otherwise the +# default is LC_CTYPE="POSIX". +export LC_CTYPE="en_US.UTF-8" + +name="$1" +if test "${name}" = ""; then + name=$(basename "$(pwd)") +fi + +# config +# paths must be absolute. +reposdir="/git/" +dir="${reposdir}/${name}" +htmldir="/home/www/domains/git.codemadness.org/htdocs" +stagitdir="/" +destdir="${htmldir}${stagitdir}" +cachefile=".htmlcache" +# /config + +if ! test -d "${dir}"; then + echo "${dir} does not exist" >&2 + exit 1 +fi +cd "${dir}" || exit 1 + +# detect git push -f +force=0 +while read -r old new ref; do + test "${old}" = "0000000000000000000000000000000000000000" && continue + test "${new}" = "0000000000000000000000000000000000000000" && continue + + hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) + if test -n "${hasrevs}"; then + force=1 + break + fi +done + +# strip .git suffix. +r=$(basename "${name}") +d=$(basename "${name}" ".git") +printf "[%s] stagit HTML pages... " "${d}" + +mkdir -p "${destdir}/${d}" +cd "${destdir}/${d}" || exit 1 + +# remove commits and ${cachefile} on git push -f, this recreated later on. +if test "${force}" = "1"; then + rm -f "${cachefile}" + rm -rf "commit" +fi + +# make index. +stagit-index "${reposdir}/"*/ > "${destdir}/index.html" + +# make pages. +stagit -c "${cachefile}" "${reposdir}/${r}" + +ln -sf log.html index.html +ln -sf ../style.css style.css +ln -sf ../logo.png logo.png + +echo "done" diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +stagit +stagit-index diff --git a/post-recieve-sys9wm.sh b/post-recieve-sys9wm.sh @@ -0,0 +1,73 @@ +#!/bin/sh +# generic git post-receive hook. +# change the config options below and call this script in your post-receive +# hook or symlink it. +# +# usage: $0 [name] +# +# if name is not set the basename of the current directory is used, +# this is the directory of the repo when called from the post-receive script. + +# NOTE: needs to be set for correct locale (expects UTF-8) otherwise the +# default is LC_CTYPE="POSIX". +export LC_CTYPE="en_US.UTF-8" + +name="$1" +if test "${name}" = ""; then + name=$(basename "$(pwd)") +fi + +# config +# paths must be absolute. +reposdir="/srv/git" +dir="${reposdir}/${name}" +htmldir="/var/www/git/sys9wm" +stagitdir="/" +destdir="${htmldir}${stagitdir}" +cachefile=".htmlcache" +# /config + +if ! test -d "${dir}"; then + echo "${dir} does not exist" >&2 + exit 1 +fi +cd "${dir}" || exit 1 + +# detect git push -f +force=0 +while read -r old new ref; do + test "${old}" = "0000000000000000000000000000000000000000" && continue + test "${new}" = "0000000000000000000000000000000000000000" && continue + + hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) + if test -n "${hasrevs}"; then + force=1 + break + fi +done + +# strip .git suffix. +r=$(basename "${name}") +d=$(basename "${name}" ".git") +printf "[%s] stagit HTML pages... " "${d}" + +mkdir -p "${destdir}/${d}" +cd "${destdir}/${d}" || exit 1 + +# remove commits and ${cachefile} on git push -f, this recreated later on. +if test "${force}" = "1"; then + rm -f "${cachefile}" + rm -rf "commit" +fi + +# make index. +stagit-index "${reposdir}/"*/ > "${destdir}/index.html" + +# make pages. +stagit -c "${cachefile}" "${reposdir}/${r}" + +ln -sf log.html index.html +ln -sf ../style.css style.css +ln -sf ../logo.png logo.png + +echo "done" diff --git a/post-recieve~ b/post-recieve~ @@ -0,0 +1,73 @@ +#!/bin/sh +# generic git post-receive hook. +# change the config options below and call this script in your post-receive +# hook or symlink it. +# +# usage: $0 [name] +# +# if name is not set the basename of the current directory is used, +# this is the directory of the repo when called from the post-receive script. + +# NOTE: needs to be set for correct locale (expects UTF-8) otherwise the +# default is LC_CTYPE="POSIX". +export LC_CTYPE="en_US.UTF-8" + +name="$1" +if test "${name}" = ""; then + name=$(basename "$(pwd)") +fi + +# config +# paths must be absolute. +reposdir="/home/src/src" +dir="${reposdir}/${name}" +htmldir="/home/www/domains/git.codemadness.org/htdocs" +stagitdir="/" +destdir="${htmldir}${stagitdir}" +cachefile=".htmlcache" +# /config + +if ! test -d "${dir}"; then + echo "${dir} does not exist" >&2 + exit 1 +fi +cd "${dir}" || exit 1 + +# detect git push -f +force=0 +while read -r old new ref; do + test "${old}" = "0000000000000000000000000000000000000000" && continue + test "${new}" = "0000000000000000000000000000000000000000" && continue + + hasrevs=$(git rev-list "${old}" "^${new}" | sed 1q) + if test -n "${hasrevs}"; then + force=1 + break + fi +done + +# strip .git suffix. +r=$(basename "${name}") +d=$(basename "${name}" ".git") +printf "[%s] stagit HTML pages... " "${d}" + +mkdir -p "${destdir}/${d}" +cd "${destdir}/${d}" || exit 1 + +# remove commits and ${cachefile} on git push -f, this recreated later on. +if test "${force}" = "1"; then + rm -f "${cachefile}" + rm -rf "commit" +fi + +# make index. +stagit-index "${reposdir}/"*/ > "${destdir}/index.html" + +# make pages. +stagit -c "${cachefile}" "${reposdir}/${r}" + +ln -sf log.html index.html +ln -sf ../style.css style.css +ln -sf ../logo.png logo.png + +echo "done" diff --git a/reallocarray.o b/reallocarray.o Binary files differ. diff --git a/stagit b/stagit Binary files differ. diff --git a/stagit-index b/stagit-index Binary files differ. diff --git a/stagit-index.c b/stagit-index.c @@ -12,7 +12,7 @@ static git_repository *repo; static const char *relpath = ""; -static char description[255] = "Repositories"; +static char description[255] = "lleb labs git server"; static char *name = ""; static char owner[255]; @@ -77,7 +77,7 @@ writeheader(FILE *fp) fputs("</span></td></tr><tr><td></td><td>\n" "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n" "<table id=\"index\"><thead>\n" - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>" + "<tr><td><b>Name</b></td><td><b>Description</b></td>" /* <td><b>Owner</b></td> */ "<td><b>Last commit</b></td></tr>" "</thead><tbody>\n", fp); } @@ -124,8 +124,8 @@ writelog(FILE *fp) fputs("</a></td><td>", fp); xmlencode(fp, description, strlen(description)); fputs("</td><td>", fp); - xmlencode(fp, owner, strlen(owner)); - fputs("</td><td>", fp); + /* xmlencode(fp, owner, strlen(owner)); + fputs("</td><td>", fp); */ if (author) printtimeshort(fp, &(author->when)); fputs("</td></tr>", fp); @@ -194,8 +194,8 @@ main(int argc, char *argv[]) description[0] = '\0'; fclose(fp); } - - /* read owner or .git/owner */ + + /* read owner or .git/owner joinpath(path, sizeof(path), repodir, "owner"); if (!(fp = fopen(path, "r"))) { joinpath(path, sizeof(path), repodir, ".git/owner"); @@ -208,6 +208,7 @@ main(int argc, char *argv[]) owner[strcspn(owner, "\n")] = '\0'; fclose(fp); } + */ writelog(stdout); } writefooter(stdout); diff --git a/stagit-index.o b/stagit-index.o Binary files differ. diff --git a/stagit.o b/stagit.o Binary files differ. diff --git a/strlcat.o b/strlcat.o Binary files differ. diff --git a/strlcpy.o b/strlcpy.o Binary files differ.