aboutsummaryrefslogtreecommitdiffstats
path: root/stagit.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <[email protected]>2021-03-05 11:51:21 +0100
committerHiltjo Posthuma <[email protected]>2021-03-05 11:51:21 +0100
commit7968c0bc9c0172bd654e1f87d8194aef7fb69865 (patch)
tree52018dfbf0b80f4013d225409d0fafc5fb8ecb7c /stagit.c
parentd1c528fb5ad81c876f07a69e1b759764f69cb9de (diff)
downloadstagit-7968c0bc9c0172bd654e1f87d8194aef7fb69865.tar.gz
stagit-7968c0bc9c0172bd654e1f87d8194aef7fb69865.zip
add $STAGIT_BASEURL environment variable to make Atom links absolute
With feedback from adc, thanks!
Diffstat (limited to 'stagit.c')
-rw-r--r--stagit.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/stagit.c b/stagit.c
index 98035e9..023ae55 100644
--- a/stagit.c
+++ b/stagit.c
@@ -58,6 +58,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;
@@ -807,8 +808,8 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
xmlencode(fp, ci->summary, strlen(ci->summary));
fputs("</title>\n", fp);
}
- fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"commit/%s.html\" />\n",
- ci->oid);
+ fprintf(fp, "<link rel=\"alternate\" type=\"text/html\" href=\"%scommit/%s.html\" />\n",
+ baseurl, ci->oid);
if (ci->author) {
fputs("<author>\n<name>", fp);
@@ -1184,6 +1185,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]);