stagit - Custom fork of stagit
ssh://anon@thyssentishman.com/stagit
Log | Files | Refs | Feed | Contribute | README | LICENSE

Commit: 92675b071611726dee0359201c0cca9ec23740e4
Parent: e7471e4fc0ca2e352dd5ac96e642c5ca7a5a5e33
Author: Johannes Thyssen Tishman
Date:   Tue, 26 Nov 2024 15:46:29 +0000

Modify diffstat format

Diffstat:
M stagit.c | 14 +++++++-------

1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/stagit.c b/stagit.c
@@ -643,7 +643,7 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 	}
 
 	/* diff stat */
-	fputs("<b>Diffstat:</b>\n<table>", fp);
+	fputs("Diffstat:\n", fp);
 	for (i = 0; i < ci->ndeltas; i++) {
 		delta = git_patch_get_delta(ci->deltas[i]->patch);
 
@@ -657,11 +657,11 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 		default:                   c = ' '; break;
 		}
 		if (c == ' ')
-			fprintf(fp, "<tr><td>%c", c);
+			fprintf(fp, "%c", c);
 		else
-			fprintf(fp, "<tr><td class=\"%c\">%c", c, c);
+			fprintf(fp, "<span class=\"%c\">%c", c, c);
 
-		fprintf(fp, "</td><td><a href=\"#h%zu\">", i);
+		fprintf(fp, "</span> <a href=\"#h%zu\">", i);
 		xmlencode(fp, delta->old_file.path, strlen(delta->old_file.path));
 		if (strcmp(delta->old_file.path, delta->new_file.path)) {
 			fputs(" -&gt; ", fp);
@@ -681,14 +681,14 @@ printshowfile(FILE *fp, struct commitinfo *ci)
 		memset(&linestr, '+', add);
 		memset(&linestr[add], '-', del);
 
-		fprintf(fp, "</a></td><td> | </td><td class=\"num\">%zu</td><td><span class=\"i\">",
+		fprintf(fp, "</a> | <span class=\"num\">%zu</span> <span class=\"i\">",
 		        ci->deltas[i]->addcount + ci->deltas[i]->delcount);
 		fwrite(&linestr, 1, add, fp);
 		fputs("</span><span class=\"d\">", fp);
 		fwrite(&linestr[add], 1, del, fp);
-		fputs("</span></td></tr>\n", fp);
+		fputs("</span>\n", fp);
 	}
-	fprintf(fp, "</table></pre><pre>%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)\n",
+	fprintf(fp, "</pre><pre>%zu file%s changed, %zu insertion%s(+), %zu deletion%s(-)\n",
 		ci->filecount, ci->filecount == 1 ? "" : "s",
 	        ci->addcount,  ci->addcount  == 1 ? "" : "s",
 	        ci->delcount,  ci->delcount  == 1 ? "" : "s");