stagit

My fork of stagit

git clone git://git.shimmy1996.com/stagit.git
commit 666699c926abb2434903711676501e597c69d73a
parent 0213ffcf10c8484f5d3c216ddcaf9d1bc55990b0
Author: Shimmy Xu <shimmy.xu@shimmy1996.com>
Date:   Sat,  4 Apr 2020 18:21:46 -0500

Add what's needed to make Atom feed valid

Diffstat:
Mstagit.c | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/stagit.c b/stagit.c
@@ -63,6 +63,7 @@ static char *name = "";
 static char *strippedname = "";
 static char description[255];
 static char cloneurl[1024];
+static char baseurl[255] = "https://git.shimmy1996.com";
 static char *submodules;
 static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:LICENSE.md", "HEAD:COPYING" };
 static char *license;
@@ -780,7 +781,11 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
 {
 	fputs("<entry>\n", fp);
 
-	fprintf(fp, "<id>%s</id>\n", ci->oid);
+    fputs("<id>", fp);
+	xmlencode(fp, baseurl, strlen(baseurl));
+	fputs("/", fp);
+	xmlencode(fp, strippedname, strlen(strippedname));
+	fprintf(fp, "/commit/%s.html</id>\n", ci->oid);
 	if (ci->author) {
 		fputs("<published>", fp);
 		printtimez(fp, &(ci->author->when));
@@ -847,7 +852,15 @@ writeatom(FILE *fp, int all)
 	xmlencode(fp, strippedname, strlen(strippedname));
 	fputs(", branch HEAD</title>\n<subtitle>", fp);
 	xmlencode(fp, description, strlen(description));
-	fputs("</subtitle>\n", fp);
+	fputs("</subtitle>\n<link href=\"", fp);
+	xmlencode(fp, baseurl, strlen(baseurl));
+	fputs("/", fp);
+	xmlencode(fp, strippedname, strlen(strippedname));
+	fputs("/atom.xml\" rel=\"self\"/>\n<id>", fp);
+    xmlencode(fp, baseurl, strlen(baseurl));
+	fputs("/", fp);
+	xmlencode(fp, strippedname, strlen(strippedname));
+	fputs("</id>", fp);
 
 	/* all commits or only tags? */
 	if (all) {