From 695b45466a4ad8c9624e8dcbfa10f19dbab6f941 Mon Sep 17 00:00:00 2001 From: acidvegas Date: Tue, 27 Jun 2023 19:56:40 -0400 Subject: [PATCH] Added archive feature for repositories to download a tar.gz of the entire repository --- assets/helper | 2 +- assets/post-receive | 2 +- assets/post-recieve | 14 -------------- stagit.c | 4 +++- 4 files changed, 5 insertions(+), 17 deletions(-) delete mode 100755 assets/post-recieve diff --git a/assets/helper b/assets/helper index 93494c3..ce86d35 100755 --- 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 index f47280c..51716cb 100755 --- 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 deleted file mode 100755 index db27fb7..0000000 --- a/assets/post-recieve +++ /dev/null @@ -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 index b57104b..513163d 100644 --- a/stagit.c +++ b/stagit.c @@ -493,7 +493,8 @@ void writeheader(FILE *fp, const char *title) { fputs("\t\t\n", fp); fprintf(fp, "Log | ", relpath); fprintf(fp, "Files | ", relpath); - fprintf(fp, "Refs", relpath); + fprintf(fp, "Refs | ", relpath); + fprintf(fp, "Archive", relpath); if (submodules) fprintf(fp, " | Submodules", relpath, submodules); if (readme) @@ -501,6 +502,7 @@ void writeheader(FILE *fp, const char *title) { fprintf(fp, " | README", relpath); if (license) fprintf(fp, " | LICENSE", relpath, license); + fputs("\n\t\n\n
\n", fp); }