Introduction
Introduction Statistics Contact Development Disclaimer Help
add $STAGIT_BASEURL environment variable to make Atom links absolute - stagit-g…
git clone git://git.codemadness.org/stagit-gopher
Log
Files
Refs
README
LICENSE
---
commit a4d283cbe995468334872de7c5bff0ef5633c747
parent a8a22b38a884641557532a52eff67ad3ba530d30
Author: Hiltjo Posthuma <[email protected]>
Date: Fri, 5 Mar 2021 11:52:44 +0100
add $STAGIT_BASEURL environment variable to make Atom links absolute
And to specify the correct gopher type.
With feedback from adc, thanks!
Diffstat:
M stagit-gopher.1 | 12 +++++++++++-
M stagit-gopher.c | 8 ++++++--
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/stagit-gopher.1 b/stagit-gopher.1
@@ -1,4 +1,4 @@
-.Dd July 19, 2020
+.Dd March 4, 2021
.Dt STAGIT-GOPHER 1
.Os
.Sh NAME
@@ -95,6 +95,16 @@ primary clone url of the repository, for example: git://git.…
.Pp
When a README or LICENSE file exists in HEAD or a .gitmodules submodules file
exists in HEAD a direct link in the index is made.
+.Sh ENVIRONMENT
+.Bl -tag -width Ds
+.It Ev STAGIT_BASEURL
+Base URL to make links in atom.xml absolute.
+Does not use the prefix from the -b option.
+It should include the gopher type.
+For example: STAGIT_BASE_URL="gopher://codemadness.org/1/git/stagit-gopher/".
+.El
+.Sh EXIT STATUS
+.Ex -std
.Sh SEE ALSO
.Xr stagit-gopher-index 1
.Sh AUTHORS
diff --git a/stagit-gopher.c b/stagit-gopher.c
@@ -62,6 +62,7 @@ struct referenceinfo {
static git_repository *repo;
+static const char *baseurl = ""; /* base URL to make absolute RSS/Atom URI */
static const char *relpath = "";
static const char *repodir;
@@ -913,8 +914,8 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char…
xmlencode(fp, ci->summary, strlen(ci->summary));
fputs("</title>\n", fp);
}
- fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"commit/…
- ci->oid);
+ fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"%scommi…
+ baseurl, ci->oid);
if (ci->author) {
fputs("<author>\n<name>", fp);
@@ -1289,6 +1290,9 @@ main(int argc, char *argv[])
}
#endif
+ if ((p = getenv("STAGIT_BASEURL")))
+ baseurl = p;
+
if (git_repository_open_ext(&repo, repodir,
GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
fprintf(stderr, "%s: cannot open repository\n", argv[0]);
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.