stagit

- static git page generator
git clone git://git.acid.vegas/stagit.git
Log | Files | Refs | Archive | README | LICENSE

commit 695b45466a4ad8c9624e8dcbfa10f19dbab6f941
parent f55a30b48d0764d9987ffd85a1a4e000eb56ce90
Author: acidvegas <acid.vegas@acid.vegas>
Date: Tue, 27 Jun 2023 19:56:40 -0400

Added archive feature for repositories to download a tar.gz of the entire repository

Diffstat:
Massets/helper | 2+-
Massets/post-receive | 2+-
Dassets/post-recieve | 14--------------
Mstagit.c | 4+++-

4 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/assets/helper b/assets/helper
@@ -61,7 +61,7 @@ make_repos() {
 		echo "[~] processing '$REPO' repository..."
 		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/.git archive --format=tar.gz -o "$HTML_DIR/$REPO/$REPO.tar.gz" --prefix="$REPO/" HEAD
+		git --git-dir $dir/.git archive --format=tar.gz -o "$HTML_DIR/$REPO/archive.tar.gz" --prefix="$REPO/" HEAD
 	done
 }
 
diff --git a/assets/post-receive b/assets/post-receive
@@ -11,4 +11,4 @@ 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/$REPO.tar.gz" --prefix="$REPO/" HEAD
+git --git-dir $DIR archive --format=tar.gz -o "$HTML_DIR/$REPO/$archive.tar.gz" --prefix="$REPO/" HEAD
diff --git a/assets/post-recieve b/assets/post-recieve
@@ -1,14 +0,0 @@
-#!/bin/sh
-# stagit post-recieve script - developed by acidevegas (https://git.acid.vegas/stagit)
-
-URL="git.acid.vegas"
-PROTO="https"
-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/$REPO.tar.gz" --prefix="$REPO/" HEAD
diff --git a/stagit.c b/stagit.c
@@ -493,7 +493,8 @@ void writeheader(FILE *fp, const char *title) {
 	fputs("\t\t<tr><td>\n", fp);
 	fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath);
 	fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath);
-	fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath);
+	fprintf(fp, "<a href=\"%srefs.html\">Refs</a> | ", relpath);
+	fprintf(fp, "<a href=\"%sarchive.tar.gz\">Archive</a>", relpath);
 	if (submodules)
 		fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>", relpath, submodules);
 	if (readme)
@@ -501,6 +502,7 @@ void writeheader(FILE *fp, const char *title) {
 		fprintf(fp, " | <a href=\"%sREADME.html\">README</a>", relpath);
 	if (license)
 		fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>", relpath, license);
+
 	fputs("</td></tr>\n\t</table>\n</div>\n<br>\n", fp);
 }