stagit

Personal fork of stagit.
git clone git://git.samirparikh.com/stagit
Log | Files | Refs | README | LICENSE

commit 89c3e32698491ce4269e57dd6dcf3c6aa98ba622
parent e0b2835a28c1e00b471dd88b0a35bfe1eda8a71d
Author: Samir Parikh <siparikh@gmail.com>
Date:   Fri, 12 Nov 2021 16:26:41 -0500

update stagit-index.c to reflect original version

Diffstat:
Mstagit-index.c | 50+++++++++++++++++---------------------------------
1 file changed, 17 insertions(+), 33 deletions(-)

diff --git a/stagit-index.c b/stagit-index.c @@ -12,10 +12,9 @@ static git_repository *repo; static const char *relpath = ""; -static char description[255] = "Oscar Benedito's Git repositories"; +static char description[255] = "Repositories"; static char *name = ""; static char owner[255]; -static char category[255]; void joinpath(char *buf, size_t bufsiz, const char *path, const char *path2) @@ -70,27 +69,24 @@ writeheader(FILE *fp) "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" "<title>", fp); xmlencode(fp, description, strlen(description)); - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/svg+xml\" href=\"../%slogo.svg\" />\n", relpath); - fprintf(fp, "<link rel=\"alternate icon\" href=\"%sfavicon.ico\" />\n", relpath); + fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath); fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath); - fputs("</head>\n<body id=\"home\">\n<h1>", fp); + fputs("</head>\n<body>\n", fp); + fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n" + "<td><span class=\"desc\">", relpath); xmlencode(fp, description, strlen(description)); - fputs("</h1>\n<div id=\"content\">\n" - "<h2 id=\"repositories\">Repositories</h2>\n" - "<div class=\"table-container\">\n<table id=\"index\"><thead>\n" - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Last commit</b></td></tr>" + fputs("</span></td></tr><tr><td></td><td>\n" + "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n" + "<table id=\"index\"><thead>\n" + "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>" + "<td><b>Last commit</b></td></tr>" "</thead><tbody>\n", fp); } void writefooter(FILE *fp) { - fputs("</tbody>\n</table>\n</div>\n" - "<h2 id=\"contribute\">Contribute</h2>\n" - "<p>The best way to contribute to my repositories is through e-mail, check out <a href=\"https://git-send-email.io\">git-send-email.io</a> if you don’t know how to do that. Send your patches to <a href=\"mailto:patches@oscarbenedito.com\">patches@oscarbenedito.com</a> and change the subject prefix to specify the repository you are sending the patch for. You can do that running the following command from the git repository:</p>\n" - "<pre><code>git config format.subjectPrefix \"PATCH &lt;name-of-repository&gt;\"</code></pre>\n" - "<p>You can also contribute on <a href=\"https://github.com/oscarbenedito\">GitHub</a> doing pull requests (all my public repositories are mirrored there, as well as <a href=\"https://git.sr.ht/~ob\">Sourcehut</a>).</p>\n" - "</div>\n</body>\n</html>\n", fp); + fputs("</tbody>\n</table>\n</div>\n</body>\n</html>\n", fp); } int @@ -121,16 +117,18 @@ writelog(FILE *fp) if (!strcmp(p, ".git")) *p = '\0'; - fputs("<tr class=\"repo\"><td><a href=\"", fp); + fputs("<tr><td><a href=\"", fp); xmlencode(fp, stripped_name, strlen(stripped_name)); - fputs("/\">", fp); + fputs("/log.html\">", fp); xmlencode(fp, stripped_name, strlen(stripped_name)); fputs("</a></td><td>", fp); xmlencode(fp, description, strlen(description)); fputs("</td><td>", fp); + xmlencode(fp, owner, strlen(owner)); + fputs("</td><td>", fp); if (author) printtimeshort(fp, &(author->when)); - fputs("</td></tr>\n", fp); + fputs("</td></tr>", fp); git_commit_free(commit); err: @@ -146,7 +144,7 @@ main(int argc, char *argv[]) FILE *fp; char path[PATH_MAX], repodirabs[PATH_MAX + 1]; const char *repodir; - int i, ret = 0, tmp; + int i, ret = 0; if (argc < 2) { fprintf(stderr, "%s [repodir...]\n", argv[0]); @@ -163,17 +161,6 @@ main(int argc, char *argv[]) writeheader(stdout); for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-c")) { - i++; - if (i == argc) - err(1, "missing argument"); - repodir = argv[i]; - fputs("<tr class=\"cat\"><td>", stdout); - xmlencode(stdout, repodir, strlen(repodir)); - fputs("</td><td></td><td></td></tr>\n", stdout); - continue; - } - repodir = argv[i]; if (!realpath(repodir, repodirabs)) err(1, "realpath"); @@ -201,9 +188,6 @@ main(int argc, char *argv[]) if (fp) { if (!fgets(description, sizeof(description), fp)) description[0] = '\0'; - tmp = strlen(description); - if (tmp > 0 && description[tmp-1] == '\n') - description[tmp-1] = '\0'; fclose(fp); }