stagit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 0ab62ec090143dd22ec5ebf0d962033e1d3d558a
parent 18431d188a887d0589069f6bd172fe3a5b0c4b13
Author: quantumish <freifeld.david@gmail.com>
Date:   Thu, 23 Jul 2026 05:06:11 +0100

Limit commit message lengths

Diffstat:
Mstagit.c | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/stagit.c b/stagit.c @@ -69,10 +69,12 @@ static char cloneurl[1024]; static char *submodules; static char *licensefiles[] = { "HEAD:LICENSE", "HEAD:LICENSE.md", "HEAD:LICENSE.txt", "HEAD:COPYING" }; static char *license; -static char *readmefiles[] = { "HEAD:README", "HEAD:README.md" }; +static char *readmefiles[] = { "HEAD:README", "HEAD:README.md", "HEAD:readme.md", "HEAD:README.org", "HEAD:readme.org" }; static char *readme; static long long nlogcommits = -1; /* -1 indicates not used */ +static long long nlogsummary = 80; + /* cache */ static git_oid lastoid; static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + NUL byte */ @@ -745,13 +747,24 @@ printshowfile(FILE *fp, struct commitinfo *ci) void writelogline(FILE *fp, struct commitinfo *ci) { + size_t len; + char *copy; fputs("<tr><td>", fp); if (ci->author) printtimeshort(fp, &(ci->author->when)); fputs("</td><td>", fp); if (ci->summary) { fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid); - xmlencode(fp, ci->summary, strlen(ci->summary)); + len = strlen(ci->summary); + if (len > nlogsummary) { + copy = strdup(ci->summary); + copy[nlogsummary] = '\0'; + memset(copy + nlogsummary - 3, '.', 3); + xmlencode(fp, copy, strlen(ci->summary)); + free(copy); + } else { + xmlencode(fp, ci->summary, strlen(ci->summary)); + } fputs("</a>", fp); } fputs("</td><td>", fp);