stagit-20251202-6c9e61a.diff (11789B)
1 From 6c9e61a8eb6cf573919b1a0cc3e1c5b617dad423 Mon Sep 17 00:00:00 2001 2 From: nathanael <nathanael@dalliard.ch> 3 Date: Tue, 2 Dec 2025 12:20:53 +0100 4 Subject: [PATCH] apply my changes 5 6 --- 7 stagit-index.c | 24 +++++++-------- 8 stagit.c | 84 +++++++++++++++++++++++++------------------------- 9 2 files changed, 54 insertions(+), 54 deletions(-) 10 11 diff --git a/stagit-index.c b/stagit-index.c 12 index 6402296..fb6e764 100644 13 --- a/stagit-index.c 14 +++ b/stagit-index.c 15 @@ -12,7 +12,7 @@ static git_repository *repo; 16 17 static const char *relpath = ""; 18 19 -static char description[255] = "Repositories"; 20 +static char description[255] = "repositories"; 21 static char *name = ""; 22 static char owner[255]; 23 24 @@ -95,23 +95,23 @@ printtimeshort(FILE *fp, const git_time *intime) 25 void 26 writeheader(FILE *fp) 27 { 28 - fputs("<!DOCTYPE html>\n" 29 - "<html>\n<head>\n" 30 - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" 31 - "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" 32 + fputs("<!doctype html>\n" 33 + "<html lang=\"en\">\n<head>\n" 34 + "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n" 35 + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" 36 "<title>", fp); 37 xmlencode(fp, description, strlen(description)); 38 - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath); 39 - fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath); 40 + fprintf(fp, "</title>\n<link rel=\"icon\" href=\"%sdata:,\">\n", relpath); 41 + fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\">\n", relpath); 42 fputs("</head>\n<body>\n", fp); 43 - fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></td>\n" 44 + fprintf(fp, "<table>\n<tr><td><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\"></td>\n" 45 "<td><span class=\"desc\">", relpath); 46 xmlencode(fp, description, strlen(description)); 47 fputs("</span></td></tr><tr><td></td><td>\n" 48 - "</td></tr>\n</table>\n<hr/>\n<div id=\"content\">\n" 49 + "</td></tr>\n</table>\n<hr>\n<div id=\"content\">\n" 50 "<table id=\"index\"><thead>\n" 51 - "<tr><td><b>Name</b></td><td><b>Description</b></td><td><b>Owner</b></td>" 52 - "<td><b>Last commit</b></td></tr>" 53 + "<tr><td><b>name</b></td><td><b>description</b></td><td><b>owner</b></td>" 54 + "<td><b>last commit</b></td></tr>" 55 "</thead><tbody>\n", fp); 56 } 57 58 @@ -151,7 +151,7 @@ writelog(FILE *fp) 59 60 fputs("<tr><td><a href=\"", fp); 61 percentencode(fp, stripped_name, strlen(stripped_name)); 62 - fputs("/log.html\">", fp); 63 + fputs("/\">", fp); 64 xmlencode(fp, stripped_name, strlen(stripped_name)); 65 fputs("</a></td><td>", fp); 66 xmlencode(fp, description, strlen(description)); 67 diff --git a/stagit.c b/stagit.c 68 index 03f0c09..418e942 100644 69 --- a/stagit.c 70 +++ b/stagit.c 71 @@ -499,10 +499,10 @@ printtimeshort(FILE *fp, const git_time *intime) 72 void 73 writeheader(FILE *fp, const char *title) 74 { 75 - fputs("<!DOCTYPE html>\n" 76 - "<html>\n<head>\n" 77 - "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n" 78 - "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" 79 + fputs("<!doctype html>\n" 80 + "<html lang=\"en\">\n<head>\n" 81 + "<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">\n" 82 + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" 83 "<title>", fp); 84 xmlencode(fp, title, strlen(title)); 85 if (title[0] && strippedname[0]) 86 @@ -511,16 +511,16 @@ writeheader(FILE *fp, const char *title) 87 if (description[0]) 88 fputs(" - ", fp); 89 xmlencode(fp, description, strlen(description)); 90 - fprintf(fp, "</title>\n<link rel=\"icon\" type=\"image/png\" href=\"%sfavicon.png\" />\n", relpath); 91 + fprintf(fp, "</title>\n<link rel=\"icon\" href=\"%sfavicon.png\">\n", relpath); 92 fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp); 93 xmlencode(fp, name, strlen(name)); 94 - fprintf(fp, " Atom Feed\" href=\"%satom.xml\" />\n", relpath); 95 + fprintf(fp, " atom feed\" href=\"%satom.xml\">\n", relpath); 96 fputs("<link rel=\"alternate\" type=\"application/atom+xml\" title=\"", fp); 97 xmlencode(fp, name, strlen(name)); 98 - fprintf(fp, " Atom Feed (tags)\" href=\"%stags.xml\" />\n", relpath); 99 - fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\" />\n", relpath); 100 + fprintf(fp, " atom feed (tags)\" href=\"%stags.xml\">\n", relpath); 101 + fprintf(fp, "<link rel=\"stylesheet\" type=\"text/css\" href=\"%sstyle.css\">\n", relpath); 102 fputs("</head>\n<body>\n<table><tr><td>", fp); 103 - fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\" /></a>", 104 + fprintf(fp, "<a href=\"../%s\"><img src=\"%slogo.png\" alt=\"\" width=\"32\" height=\"32\"></a>", 105 relpath, relpath); 106 fputs("</td><td><h1>", fp); 107 xmlencode(fp, strippedname, strlen(strippedname)); 108 @@ -528,26 +528,26 @@ writeheader(FILE *fp, const char *title) 109 xmlencode(fp, description, strlen(description)); 110 fputs("</span></td></tr>", fp); 111 if (cloneurl[0]) { 112 - fputs("<tr class=\"url\"><td></td><td>git clone <a href=\"", fp); 113 + fputs("<tr class=\"url\"><td></td><td>got clone <a href=\"", fp); 114 xmlencode(fp, cloneurl, strlen(cloneurl)); /* not percent-encoded */ 115 fputs("\">", fp); 116 xmlencode(fp, cloneurl, strlen(cloneurl)); 117 fputs("</a></td></tr>", fp); 118 } 119 fputs("<tr><td></td><td>\n", fp); 120 - fprintf(fp, "<a href=\"%slog.html\">Log</a> | ", relpath); 121 - fprintf(fp, "<a href=\"%sfiles.html\">Files</a> | ", relpath); 122 - fprintf(fp, "<a href=\"%srefs.html\">Refs</a>", relpath); 123 + fprintf(fp, "<a href=\"%slog.html\">log</a> | ", relpath); 124 + fprintf(fp, "<a href=\"%sfiles.html\">files</a> | ", relpath); 125 + fprintf(fp, "<a href=\"%srefs.html\">refs</a>", relpath); 126 if (submodules) 127 - fprintf(fp, " | <a href=\"%sfile/%s.html\">Submodules</a>", 128 + fprintf(fp, " | <a href=\"%sfile/%s.html\">submodules</a>", 129 relpath, submodules); 130 if (readme) 131 - fprintf(fp, " | <a href=\"%sfile/%s.html\">README</a>", 132 + fprintf(fp, " | <a href=\"%sfile/%s.html\">readme</a>", 133 relpath, readme); 134 if (license) 135 - fprintf(fp, " | <a href=\"%sfile/%s.html\">LICENSE</a>", 136 + fprintf(fp, " | <a href=\"%sfile/%s.html\">license</a>", 137 relpath, license); 138 - fputs("</td></tr></table>\n<hr/>\n<div id=\"content\">\n", fp); 139 + fputs("</td></tr></table>\n<hr>\n<div id=\"content\">\n", fp); 140 } 141 142 void 143 @@ -600,13 +600,13 @@ printcommit(FILE *fp, struct commitinfo *ci) 144 relpath, ci->parentoid, ci->parentoid); 145 146 if (ci->author) { 147 - fputs("<b>Author:</b> ", fp); 148 + fputs("<b>author:</b> ", fp); 149 xmlencode(fp, ci->author->name, strlen(ci->author->name)); 150 fputs(" <<a href=\"mailto:", fp); 151 xmlencode(fp, ci->author->email, strlen(ci->author->email)); /* not percent-encoded */ 152 fputs("\">", fp); 153 xmlencode(fp, ci->author->email, strlen(ci->author->email)); 154 - fputs("</a>>\n<b>Date:</b> ", fp); 155 + fputs("</a>>\n<b>date:</b> ", fp); 156 printtime(fp, &(ci->author->when)); 157 putc('\n', fp); 158 } 159 @@ -637,12 +637,12 @@ printshowfile(FILE *fp, struct commitinfo *ci) 160 ci->ndeltas > 1000 || 161 ci->addcount > 100000 || 162 ci->delcount > 100000) { 163 - fputs("Diff is too large, output suppressed.\n", fp); 164 + fputs("diff is too large, output suppressed.\n", fp); 165 return; 166 } 167 168 /* diff stat */ 169 - fputs("<b>Diffstat:</b>\n<table>", fp); 170 + fputs("<b>diffstat:</b>\n<table>", fp); 171 for (i = 0; i < ci->ndeltas; i++) { 172 delta = git_patch_get_delta(ci->deltas[i]->patch); 173 174 @@ -757,11 +757,11 @@ writelogline(FILE *fp, struct commitinfo *ci) 175 fputs("</td><td>", fp); 176 if (ci->author) 177 xmlencode(fp, ci->author->name, strlen(ci->author->name)); 178 - fputs("</td><td class=\"num\" align=\"right\">", fp); 179 + fputs("</td><td class=\"num\">", fp); 180 fprintf(fp, "%zu", ci->filecount); 181 - fputs("</td><td class=\"num\" align=\"right\">", fp); 182 + fputs("</td><td class=\"num\">", fp); 183 fprintf(fp, "+%zu", ci->addcount); 184 - fputs("</td><td class=\"num\" align=\"right\">", fp); 185 + fputs("</td><td class=\"num\">", fp); 186 fprintf(fp, "-%zu", ci->delcount); 187 fputs("</td></tr>\n", fp); 188 } 189 @@ -885,11 +885,11 @@ printcommitatom(FILE *fp, struct commitinfo *ci, const char *tag) 190 if (ci->parentoid[0]) 191 fprintf(fp, "parent %s\n", ci->parentoid); 192 if (ci->author) { 193 - fputs("Author: ", fp); 194 + fputs("author: ", fp); 195 xmlencode(fp, ci->author->name, strlen(ci->author->name)); 196 fputs(" <", fp); 197 xmlencode(fp, ci->author->email, strlen(ci->author->email)); 198 - fputs(">\nDate: ", fp); 199 + fputs(">\ndate: ", fp); 200 printtime(fp, &(ci->author->when)); 201 putc('\n', fp); 202 } 203 @@ -1078,11 +1078,11 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) 204 percentencode(fp, filepath, strlen(filepath)); 205 fputs("\">", fp); 206 xmlencode(fp, entrypath, strlen(entrypath)); 207 - fputs("</a></td><td class=\"num\" align=\"right\">", fp); 208 + fputs("</a></td><td class=\"num\">", fp); 209 if (lc > 0) 210 - fprintf(fp, "%zuL", lc); 211 + fprintf(fp, "%zul", lc); 212 else 213 - fprintf(fp, "%zuB", filesize); 214 + fprintf(fp, "%zub", filesize); 215 fputs("</td></tr>\n", fp); 216 git_object_free(obj); 217 } else if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT) { 218 @@ -1093,7 +1093,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) 219 fputs("</a> @ ", fp); 220 git_oid_tostr(oid, sizeof(oid), git_tree_entry_id(entry)); 221 xmlencode(fp, oid, strlen(oid)); 222 - fputs("</td><td class=\"num\" align=\"right\"></td></tr>\n", fp); 223 + fputs("</td><td class=\"num\"></td></tr>\n", fp); 224 } 225 } 226 227 @@ -1108,8 +1108,8 @@ writefiles(FILE *fp, const git_oid *id) 228 int ret = -1; 229 230 fputs("<table id=\"files\"><thead>\n<tr>" 231 - "<td><b>Mode</b></td><td><b>Name</b></td>" 232 - "<td class=\"num\" align=\"right\"><b>Size</b></td>" 233 + "<td><b>mode</b></td><td><b>name</b></td>" 234 + "<td class=\"num\"><b>size</b></td>" 235 "</tr>\n</thead><tbody>\n", fp); 236 237 if (!git_commit_lookup(&commit, repo, id) && 238 @@ -1130,7 +1130,7 @@ writerefs(FILE *fp) 239 struct referenceinfo *ris = NULL; 240 struct commitinfo *ci; 241 size_t count, i, j, refcount; 242 - const char *titles[] = { "Branches", "Tags" }; 243 + const char *titles[] = { "branches", "tags" }; 244 const char *ids[] = { "branches", "tags" }; 245 const char *s; 246 247 @@ -1148,9 +1148,9 @@ writerefs(FILE *fp) 248 /* print header if it has an entry (first). */ 249 if (++count == 1) { 250 fprintf(fp, "<h2>%s</h2><table id=\"%s\">" 251 - "<thead>\n<tr><td><b>Name</b></td>" 252 - "<td><b>Last commit date</b></td>" 253 - "<td><b>Author</b></td>\n</tr>\n" 254 + "<thead>\n<tr><td><b>name</b></td>" 255 + "<td><b>last commit date</b></td>" 256 + "<td><b>author</b></td>\n</tr>\n" 257 "</thead><tbody>\n", 258 titles[j], ids[j]); 259 } 260 @@ -1331,12 +1331,12 @@ main(int argc, char *argv[]) 261 fp = efopen("log.html", "w"); 262 relpath = ""; 263 mkdir("commit", S_IRWXU | S_IRWXG | S_IRWXO); 264 - writeheader(fp, "Log"); 265 - fputs("<table id=\"log\"><thead>\n<tr><td><b>Date</b></td>" 266 - "<td><b>Commit message</b></td>" 267 - "<td><b>Author</b></td><td class=\"num\" align=\"right\"><b>Files</b></td>" 268 - "<td class=\"num\" align=\"right\"><b>+</b></td>" 269 - "<td class=\"num\" align=\"right\"><b>-</b></td></tr>\n</thead><tbody>\n", fp); 270 + writeheader(fp, "log"); 271 + fputs("<table id=\"log\"><thead>\n<tr><td><b>date</b></td>" 272 + "<td><b>commit message</b></td>" 273 + "<td><b>author</b></td><td class=\"num\"><b>files</b></td>" 274 + "<td class=\"num\"><b>+</b></td>" 275 + "<td class=\"num\"><b>-</b></td></tr>\n</thead><tbody>\n", fp); 276 277 if (cachefile && head) { 278 /* read from cache file (does not need to exist) */ 279 -- 280 2.51.0 281