commit ae22c169189ca32f5be645c27356f7011d5cd534
parent 143e7419ad416436f2f97d4aee1e9131114f97cc
Author: Pollux <pollux@pollux.codes>
Date: Thu, 24 Jul 2025 01:58:31 -0500
feat: Crop commit messages to 40 characters
Also add ellipses to long messages
Signed-off-by: Pollux <pollux@pollux.codes>
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/stagit.c b/stagit.c
@@ -803,7 +803,15 @@ writelogline(FILE *fp, struct commitinfo *ci) {
fputs("</td><td>", fp);
if(ci->summary) {
fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
- xmlencode(fp, ci->summary, strlen(ci->summary));
+ char summary[41];
+ if(strlen(ci->summary) > 41) {
+ memcpy(summary, ci->summary, 37*sizeof(char));
+ memcpy(&summary[37], "...", 3*sizeof(char));
+ summary[40] = '\0';
+ } else {
+ strcpy(summary, ci->summary);
+ }
+ xmlencode(fp, summary, strlen(summary));
fputs("</a>", fp);
}
fputs("</td><td>", fp);