commit 96d88a5947be059369d206d51e6288fab37a1ad0
parent 3efa22d3fda2611902ccbadd3b53caf7569fc033
Author: gearsix <gearsix@tuta.io>
Date: Tue, 18 Feb 2025 21:51:42 +0000
Merge upstream changes into gearsix
Diffstat:
3 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/LICENSE b/LICENSE
@@ -1,6 +1,6 @@
MIT/X Consortium License
-(c) 2015-2022 Hiltjo Posthuma <hiltjo@codemadness.org>
+(c) 2015-2024 Hiltjo Posthuma <hiltjo@codemadness.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
diff --git a/stagit-index.c b/stagit-index.c
@@ -199,8 +199,14 @@ writebody(FILE *fp, char *repodir, int forks) {
if (forks != 2) {
joinpath(path, sizeof(path), repodir, ".git/fork");
fp = fopen(path, "r");
- if ((fp && forks == 0) || (!fp && forks == 1))
+ if (!fp && forks == 1)
return 0;
+ if (fp) {
+ checkfileerror(fp, ".git/fork", 'r');
+ fclose(fp);
+ if (forks == 0)
+ return 0;
+ }
}
/* use directory name as name */
@@ -219,6 +225,7 @@ writebody(FILE *fp, char *repodir, int forks) {
if (fp) {
if (!fgets(description, sizeof(description), fp))
description[0] = '\0';
+ checkfileerror(fp, "description", 'r');
fclose(fp);
}
@@ -233,6 +240,7 @@ writebody(FILE *fp, char *repodir, int forks) {
if (!fgets(owner, sizeof(owner), fp))
owner[0] = '\0';
owner[strcspn(owner, "\n")] = '\0';
+ checkfileerror(fp, "owner", 'r');
fclose(fp);
}
writelog(stdout);
@@ -280,18 +288,20 @@ main(int argc, char *argv[])
writebodyhead(stdout);
for (i = 1; i < argc; i++) {
- ret = writebody(stdout, argv[i], 0);
- if (ret != 0)
- return ret;
+ if ( writebody(stdout, argv[i], 0) != 0 ) {
+ ret = 1;
+ continue;
+ }
}
writebodyfoot(stdout);
fputs("<details open><summary><b>forks</b></summary>", stdout);
writebodyhead(stdout);
for (i = 1; i < argc; i++) {
- ret = writebody(stdout, argv[i], 1);
- if (ret != 0)
- return ret;
+ if ( writebody(stdout, argv[i], 0) != 0 ) {
+ ret = 1;
+ continue;
+ }
}
writebodyfoot(stdout);
fputs("</details>", stdout);
diff --git a/stagit.c b/stagit.c
@@ -514,15 +514,16 @@ writeheader(FILE *fp, const char *title)
fputs(" - ", fp);
xmlencode(fp, description, strlen(description));
fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", rootpath);
- fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed\" href=\"%satom.xml\" />\n",
- name, relpath);
- fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"%s Atom Feed (tags)\" href=\"%stags.xml\" />\n",
- name, relpath);
+ fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"");
+ xmlencode(fp, name, strlen(name));
+ fprintf(fp, " Atom Feed\" href=\"%satom.xml\" />\n", relpath);
+ fprintf(fp, "<link rel=\"alternate\" type=\"application/atom+xml\" title=\"");
+ xmlencode(fp, name, strlen(name));
+ fprintf(fp, " Atom Feed (tags)\" href=\"%stags.xml\" />\n", relpath);
fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", rootpath);
fputs("</head>\n<body>\n<table><tr><td id=\"logo\">", fp);
fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"50\" height=\"50\" /></a>",
relpath, rootpath);
-
fputs("</td><td><h1>", fp);
xmlencode(fp, strippedname, strlen(strippedname));
fputs("</h1><span class=\"desc\">", fp);
@@ -863,7 +864,7 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
fputs("</updated>\n", fp);
}
if (ci->summary) {
- fputs("<title type=\"text\">", fp);
+ fputs("<title>", fp);
if (tag && tag[0]) {
fputs("[", fp);
xmlencode(fp, tag, strlen(tag));
@@ -883,7 +884,7 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag)
fputs("</email>\n</author>\n", fp);
}
- fputs("<content type=\"text\">", fp);
+ fputs("<content>", fp);
fprintf(fp, "commit %s\n", ci->oid);
if (ci->parentoid[0])
fprintf(fp, "parent %s\n", ci->parentoid);
@@ -1313,6 +1314,10 @@ main(int argc, char *argv[])
snprintf(forked, 127, "- forked from <a href=\"%s\">%s</a>", url, url);
}
}
+ if (fpread) {
+ checkfileerror(fpread, path, 'r');
+ fclose(fpread);
+ }
/* read url or .git/url */
joinpath(path, sizeof(path), repodir, "url");