diff --git a/README.md b/README.md index ecf3439..f08d2d8 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,34 @@ # stagit > static git page generator -## Information +#### Information This is my personal fork of [stagit](https://codemadness.org/stagit.html) which is running [git.acid.vegas](https://git.acid.vegas/) ## Dependencies -- C compiler *(C99)* -- libc *(tested with OpenBSD, FreeBSD, NetBSD, Linux: glibc & musl)* - [libgit2](https://github.com/libgit2/libgit2) *(v0.22+)* - [md4c](https://github.com/mity/md4c) *(v0.4.4+)* -- POSIX make *(optional)* -## Setup -```shell -cd stagit -make -sudo make install -``` +## Features & Issues +###### Features +- Markdown rendering to HTML for README files +- ~~Syntax hilighting~~ +- Repository categories +- Direct download to repository tar.gz +- Style changes +- ~~Raw file viewing~~ -**NOTE**: The [/assets/](https://github.com/acidvegas/stagit/tree/master/assets) directory contains various scripts for deployment usage. - -###### New Features -- [X] Markdown rendering to HTML for README files -- [ ] Syntax hilighting -- [X] Repository categories -- [X] Direct download to repository tar.gz -- [X] Style changes -- [ ] Raw file viewing *(will tackle this one next commit)* - -###### Fixes +###### Issues - [ ] Clickable heading *(h1-h6)* links in README *(md4c does not FULLY transform markdown)* - [ ] Top/bottom padding for multi-lined `` blocks - [ ] Missing image references in README files *(md4c does not look in /files/ for the .screens directory)* +- [ ] Generating html for binary content is pointless. No links at all for these files. -###### Props +## Props - Hiltjo Posthuma *(orignal author of [stagit](https://codemadness.org/git/stagit/))* - Larry Burns *([stagit-md](https://github.com/lmburns/stagit-md))* - Oscar Benedito *([md4c implementation](https://oscarbenedito.com/blog/2020/08/adding-about-pages-to-stagit/))* + +___ + +###### Mirrors +[acid.vegas](https://git.acid.vegas/stagit) • [GitHub](https://github.com/acidvegas/stagit) • [GitLab](https://gitlab.com/acidvegas/stagit) • [SuperNETs](https://git.supernets.org/acidvegas/stagit) diff --git a/assets/post-receive b/assets/post-receive index 8c69217..aac7216 100755 --- a/assets/post-receive +++ b/assets/post-receive @@ -7,8 +7,18 @@ CLONE_URL="git://$URL" COMMIT_LIMIT=100 HTML_DIR="/srv/http" -DIR=$PWD -REPO=$(basename $DIR .git) -mkdir -p $HTML_DIR/$REPO && cd $HTML_DIR/$REPO && stagit -l $COMMIT_LIMIT -u "$PROTO://$URL/$REPO" $DIR -ln -sf log.html index.html -git --git-dir $DIR archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD +DIR="$PWD" +REPO=$(basename "$DIR" .git) + +command -v stagit >/dev/null 2>&1 || { echo "stagit not found" >&2; exit 1; } + +mkdir -p "$HTML_DIR/$REPO" || { echo "Failed to create directory $HTML_DIR/$REPO" >&2; exit 1; } + +if cd "$HTML_DIR/$REPO"; then + stagit -l "$COMMIT_LIMIT" -u "$PROTO://$URL/$REPO" "$DIR" || { echo "stagit failed to generate static pages" >&2; exit 1; } + ln -sf log.html index.html + git --git-dir="$DIR" archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD || { echo "git archive failed" >&2; exit 1; } +else + echo "Failed to change directory to $HTML_DIR/$REPO" >&2 + exit 1 +fi diff --git a/assets/repo b/assets/repo index cc9f41e..3c63d96 100755 --- a/assets/repo +++ b/assets/repo @@ -1,16 +1,31 @@ #!/bin/sh # git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit) -[ ! "$#" = '1' ] && echo "invlid arguments (use -c or -d)" && exit 1 -if [ $1 = '-c' ]; then - [ -d $2.git ] && echo "repository already exists" && exit 1 - [ ! -f post-receive ] && "missing post-receive script" && exit 1 - mkdir $2.git && git init --bare $2.git - touch $2.git/git-daemon-export-ok - ln /srv/git/git-shell-commands/post-receive $2.git/hooks/post-receive - echo "git://git.acid.vegas/$2.git" > $2.git/url -elif [ $1 = '-d' ]; then - [ ! -d $2.git ] && echo "repository does not exist" && exit 1 - rm -rf $2.git -else - echo "invlid arguments (use -c or -d)" && exit 1 + +if [ "$#" -ne 2 ]; then + echo "invalid arguments (use -c or -d)" >&2 + exit 1 +fi + +if [ "$1" = '-c' ]; then + if [ -d "$2.git" ]; then + echo "repository already exists" >&2 + exit 1 + fi + if [ ! -f post-receive ]; then + echo "missing post-receive script" >&2 + exit 1 + fi + mkdir "$2.git" && git init --bare "$2.git" || exit 1 + touch "$2.git/git-daemon-export-ok" + ln /srv/git/git-shell-commands/post-receive "$2.git/hooks/post-receive" || exit 1 + echo "git://git.acid.vegas/$2.git" > "$2.git/url" +elif [ "$1" = '-d' ]; then + if [ ! -d "$2.git" ]; then + echo "repository does not exist" >&2 + exit 1 + fi + rm -rf "$2.git" +else + echo "invalid arguments (use -c or -d)" >&2 + exit 1 fi diff --git a/stagit-index.c b/stagit-index.c index ed003e5..2277612 100644 --- a/stagit-index.c +++ b/stagit-index.c @@ -83,7 +83,7 @@ void writeheader(FILE *fp) { fputs("
\n
\n

\n", fp); fputs("
\n\t
\n\t\n\t\t\n\t
\n" "contact : discordircmailtwitter\n" - "
mirrors : githubgitlabsourcehutsupernets\n" + "
mirrors : githubgitlabsupernets\n" "\t\t
\n\t
\n
\n
\n", fp); fputs("
\n\t\n\t\t\n\t\t\t\n\t\t\n\t\t", fp); }
NameDescriptionLast commit