Update clone <tr> to use the 'url' class for Software Heritage Foundation parsers (cheers pabs3)
This commit is contained in:
parent
2a87b5b0ed
commit
f856d86071
|
@ -15,10 +15,10 @@ 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; }
|
mkdir -p "$HTML_DIR/$REPO" || { echo "Failed to create directory $HTML_DIR/$REPO" >&2; exit 1; }
|
||||||
|
|
||||||
if cd "$HTML_DIR/$REPO"; then
|
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; }
|
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
|
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; }
|
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
|
else
|
||||||
echo "Failed to change directory to $HTML_DIR/$REPO" >&2
|
echo "Failed to change directory to $HTML_DIR/$REPO" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
56
assets/repo
56
assets/repo
|
@ -1,21 +1,25 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
|
# git-shell-commands helper for stagit - developed by acidvegas (https://git.acid.vegas/stagit)
|
||||||
|
|
||||||
check_description() {
|
if [ "$#" -ne 2 ]; then
|
||||||
if [ -f $1/description ]; then
|
echo "invalid arguments (use -c or -d)"
|
||||||
if [ "$(cat $1/description)" = "Unnamed repository; edit this file 'description' to name the repository." ]; then
|
exit 1
|
||||||
read -p "description for '$REPO':" desc
|
elif [ "$1" = '-c' ]; then
|
||||||
echo "$desc" > $1/description
|
if [ -d "$2.git" ]; then
|
||||||
echo "[+] updated default 'description' file for '$REPO'"
|
echo "repository already exists"
|
||||||
fi
|
exit 1
|
||||||
else
|
else if [ ! -f post-receive ]; then
|
||||||
read -p "description for '$REPO':" desc
|
echo "missing post-receive script"
|
||||||
echo "$desc" > $1/description
|
exit 1
|
||||||
echo "[+] added missing 'description' file for '$REPO'"
|
|
||||||
fi
|
fi
|
||||||
}
|
mkdir "$2.git"
|
||||||
|
git init --bare "$2.git"
|
||||||
remake_index() {
|
touch "$2.git/git-daemon-export-ok"
|
||||||
|
ln /srv/git/git-shell-commands/post-receive "$2.git/hooks/post-receive"
|
||||||
|
echo "https://git.acid.vegas/$2.git" > "$2.git/url"
|
||||||
|
echo "Description for '$2' repository:"
|
||||||
|
read desc
|
||||||
|
echo "$desc" > "$2.git/description"
|
||||||
echo "[~] recreating index..."
|
echo "[~] recreating index..."
|
||||||
args=""
|
args=""
|
||||||
for category in $(cat /srv/git/*/owner | xargs -n1 | sort -u | xargs); do
|
for category in $(cat /srv/git/*/owner | xargs -n1 | sort -u | xargs); do
|
||||||
|
@ -24,33 +28,13 @@ remake_index() {
|
||||||
args="$args -c \"$category\" $REPOS"
|
args="$args -c \"$category\" $REPOS"
|
||||||
done
|
done
|
||||||
echo "$args" | xargs stagit-index > $HTML_DIR/index.html
|
echo "$args" | xargs stagit-index > $HTML_DIR/index.html
|
||||||
}
|
|
||||||
|
|
||||||
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 "https://git.acid.vegas/$2.git" > "$2.git/url"
|
|
||||||
elif [ "$1" = '-d' ]; then
|
elif [ "$1" = '-d' ]; then
|
||||||
if [ ! -d "$2.git" ]; then
|
if [ ! -d "$2.git" ]; then
|
||||||
echo "repository does not exist" >&2
|
echo "repository does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -rf "$2.git"
|
rm -rf "$2.git"
|
||||||
else
|
else
|
||||||
echo "invalid arguments (use -c or -d)" >&2
|
echo "invalid arguments (use -c or -d)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
2
stagit.c
2
stagit.c
|
@ -484,7 +484,7 @@ void writeheader(FILE *fp, const char *title) {
|
||||||
xmlencode(fp, description, strlen(description));
|
xmlencode(fp, description, strlen(description));
|
||||||
fputs("</span></td></tr>\n", fp);
|
fputs("</span></td></tr>\n", fp);
|
||||||
if (cloneurl[0]) {
|
if (cloneurl[0]) {
|
||||||
fputs("\t\t<tr><td><i>git clone <a href=\"", fp);
|
fputs("\t\t<tr class=\"url\"><td><i>git clone <a href=\"", fp);
|
||||||
xmlencode(fp, cloneurl, strlen(cloneurl)); /* not percent-encoded */
|
xmlencode(fp, cloneurl, strlen(cloneurl)); /* not percent-encoded */
|
||||||
fputs("\">", fp);
|
fputs("\">", fp);
|
||||||
xmlencode(fp, cloneurl, strlen(cloneurl));
|
xmlencode(fp, cloneurl, strlen(cloneurl));
|
||||||
|
|
Loading…
Reference in New Issue