]> git.armaanb.net Git - stagit.git/blobdiff - src/stagit.c
add $STAGIT_BASEURL environment variable to make Atom links absolute
[stagit.git] / src / stagit.c
index ba154d05333c177a711508414be1c288118ca8c2..d99ae191580cafebbee451b168911ff7f64ec45c 100644 (file)
@@ -56,6 +56,7 @@ struct commitinfo {
 
 static git_repository *repo;
 
+static const char *baseurl = ""; /* base URL to make absolute RSS/Atom URI */
 static const char *relpath = "";
 static const char *repodir;
 
@@ -784,8 +785,8 @@ printcommitatom(FILE *fp, struct commitinfo *ci)
                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);
@@ -1234,6 +1235,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]);