commit e355ec5954675664c256ef00030a69958db08a9e
parent 1edd1932b5c07462f6ad4387f2c3d2ddaa24658e
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 28 May 2022 17:51:49 +0200
parent 1edd1932b5c07462f6ad4387f2c3d2ddaa24658e
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 28 May 2022 17:51:49 +0200
summary: always generate page
1 file changed, 34 insertions(+), 36 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -575,12 +575,10 @@ writeheader(FILE *fp, const char *title, const char *mode) fputs("</header>\n<nav>", fp); - if (readme) { - if (!strcmp(mode, "summary")) { - fprintf(fp, "<a class=\"active\" href=\"%sindex.html\">summary</a>", relpath); - } else { - fprintf(fp, "<a href=\"%sindex.html\">summary</a>", relpath); - } + if (!strcmp(mode, "summary")) { + fprintf(fp, "<a class=\"active\" href=\"%sindex.html\">summary</a>", relpath); + } else { + fprintf(fp, "<a href=\"%sindex.html\">summary</a>", relpath); } if (!strcmp(mode, "log")) { @@ -1408,37 +1406,37 @@ main(int argc, char *argv[]) git_object_free(obj); /* summary page */ - if (readme) { - fp = efopen("index.html", "w"); - writeheader(fp, "summary", "summary"); - - git_revwalk_new(&walker, repo); - git_revwalk_push(walker, head); - - if (http_cloneurl[0] || ssh_cloneurl[0]) fputs("<div class=\"container\"><div class=\"row\"><div class=\"col-8\">", fp); - fputs("<h3>last commits</h3><div class=\"log\">", fp); - while (!git_revwalk_next(&id, walker)) { - if (!(ci = commitinfo_getbyoid(&id))) break; - if (count == 2) { - fputs("<a href=\"log.html\"><div class=\"event center-text\">more</div></a>", fp); - break; - } - count++; + fp = efopen("index.html", "w"); + writeheader(fp, "summary", "summary"); + + git_revwalk_new(&walker, repo); + git_revwalk_push(walker, head); + + if (http_cloneurl[0] || ssh_cloneurl[0]) fputs("<div class=\"container\"><div class=\"row\"><div class=\"col-8\">", fp); + fputs("<h3>last commits</h3><div class=\"log\">", fp); + while (!git_revwalk_next(&id, walker)) { + if (!(ci = commitinfo_getbyoid(&id))) break; + if (count == 2) { + fputs("<a href=\"log.html\"><div class=\"event center-text\">more</div></a>", fp); + break; + } + count++; - writelogline(fp, ci); + writelogline(fp, ci); - commitinfo_free(ci); - } - git_revwalk_free(walker); - fputs("</div>", fp); + commitinfo_free(ci); + } + git_revwalk_free(walker); + fputs("</div>", fp); - if (http_cloneurl[0] || ssh_cloneurl[0]) { - fputs("</div><div class=\"col-4\"><h3>clone</h3>", fp); - if (http_cloneurl[0]) fprintf(fp, "<dl><dt>read-only</dt><dd>%s%s</dd></dl>", http_cloneurl, strippedname); - if (ssh_cloneurl[0]) fprintf(fp, "<dl><dt>read-write</dt><dd>%s%s</dd></dl>", ssh_cloneurl, strippedname); - fputs("</div></div></div>", fp); - }; + if (http_cloneurl[0] || ssh_cloneurl[0]) { + fputs("</div><div class=\"col-4\"><h3>clone</h3>", fp); + if (http_cloneurl[0]) fprintf(fp, "<dl><dt>read-only</dt><dd>%s%s</dd></dl>", http_cloneurl, strippedname); + if (ssh_cloneurl[0]) fprintf(fp, "<dl><dt>read-write</dt><dd>%s%s</dd></dl>", ssh_cloneurl, strippedname); + fputs("</div></div></div>", fp); + }; + if (readme) { git_revparse_single(&obj, repo, readmefiles[r]); const char *s = git_blob_rawcontent((git_blob *)obj); if (r == 1 | r == 2) { @@ -1454,11 +1452,11 @@ main(int argc, char *argv[]) fputs("</pre></div>", fp); } git_object_free(obj); - - writefooter(fp); - fclose(fp); } + writefooter(fp); + fclose(fp); + /* log for HEAD */ fp = efopen("log.html", "w"); relpath = "";