stagit

truncate message in log, shorter time format

Hiltjo Posthuma contact@arjunchoudhary.com

commit: a41dd71 parent: 5337c07
1 files changed, 11 insertions(+), 6 deletions(-)
Murmoms.c+11-6
M · urmoms.c +11, -6
 1@@ -358,6 +358,7 @@ writelog(FILE *fp)
 2 	struct commitinfo *ci;
 3 	git_revwalk *w = NULL;
 4 	git_oid id;
 5+	size_t len;
 6 	int ret = 0;
 7 
 8 	mkdir("commit", 0755);
 9@@ -374,19 +375,23 @@ writelog(FILE *fp)
10 		if (!(ci = commitinfo_getbyoid(&id)))
11 			break;
12 
13-		fputs("<tr><td>", fp);
14+		fputs("<tr><td align=\"right\">", fp);
15+		if (ci->author)
16+			printtimeshort(fp, &(ci->author->when));
17+		fputs("</td><td>", fp);
18 		if (ci->summary) {
19 			fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
20-			xmlencode(fp, ci->summary, strlen(ci->summary));
21+			if ((len = strlen(ci->summary)) > 79) {
22+				xmlencode(fp, ci->summary, 76);
23+				fputs("...", fp);
24+			} else {
25+				xmlencode(fp, ci->summary, len);
26+			}
27 			fputs("</a>", fp);
28 		}
29 		fputs("</td><td>", fp);
30 		if (ci->author)
31 			xmlencode(fp, ci->author->name, strlen(ci->author->name));
32-
33-		fputs("</td><td align=\"right\">", fp);
34-		if (ci->author)
35-			printtime(fp, &(ci->author->when));
36 		fputs("</td><td align=\"right\">", fp);
37 		fprintf(fp, "%zu", ci->filecount);
38 		fputs("</td><td align=\"right\">", fp);