MIT/X Consortium License
(c) 2015-2022 Hiltjo Posthuma <hiltjo@codemadness.org>
+(c) 2022 Georgios Atheridis <georgios@atheridis.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
# - sh example_create.sh
# path must be absolute.
-reposdir="/var/www/domains/git.codemadness.nl/home/src"
-curdir="$(pwd)"
+reposdir="/home/git"
+curdir="/var/www/git.atheridis.org"
# make index.
-stagit-index "${reposdir}/"*/ > "${curdir}/index.html"
+stagit-index "${reposdir}/"*/* > "${curdir}/index.html"
# make files per repo.
-for dir in "${reposdir}/"*/; do
- # strip .git suffix.
- r=$(basename "${dir}")
- d=$(basename "${dir}" ".git")
- printf "%s... " "${d}"
+for namespace in "${reposdir}/"*/; do
+ n=$(basename "${namespace}")
+ for repo in "$namespace"*; do
+ r=$(basename "${repo}")
- mkdir -p "${curdir}/${d}"
- cd "${curdir}/${d}" || continue
- stagit -c ".cache" -u "https://git.codemadness.nl/$d/" "${reposdir}/${r}"
+ # strip .git suffix.
+ d=$(basename "${repo}" ".git")
+ printf "%s... " "${d}"
- # symlinks
- ln -sf log.html index.html
- ln -sf ../style.css style.css
- ln -sf ../logo.png logo.png
- ln -sf ../favicon.png favicon.png
+ mkdir -p "${curdir}/${n}/${d}"
+ cd "${curdir}/${n}/${d}" || continue
+ stagit -c ".cache" -u "https://git.atheridis.org/$n/$d/" "${reposdir}/${n}/${r}"
- echo "done"
+ # symlinks
+ ln -sf log.html index.html
+ ln -sf $curdir/style.css style.css
+ ln -sf $curdir/logo.png logo.png
+ ln -sf $curdir/favicon.png favicon.png
+
+ echo "done"
+ done
done
#include <err.h>
+#include <libgen.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
static const char *relpath = "";
static char description[255] = "Repositories";
+static char *namespace = "";
static char *name = "";
static char owner[255];
*p = '\0';
fputs("<tr><td><a href=\"", fp);
+ percentencode(fp, namespace, strlen(namespace));
+ fputs("/", fp);
percentencode(fp, stripped_name, strlen(stripped_name));
fputs("/log.html\">", fp);
xmlencode(fp, stripped_name, strlen(stripped_name));
continue;
}
- /* use directory name as name */
- if ((name = strrchr(repodirabs, '/')))
- name++;
- else
- name = "";
+ /* use directory name as name and namespace*/
+ name = basename(repodirabs);
+ namespace = basename(dirname(repodirabs));
/* read description or .git/description */
joinpath(path, sizeof(path), repodir, "description");