stagit

dont truncate summary length anymore

make sure not partial (invalid) utf-8 sequences are written. The old logic
truncated by bytelen was wrong. It is too complex to implement it in a
correct way with git: it is not assured a commit message is UTF-8 encoded.

remove showlinecount and summarylen variables.

Hiltjo Posthuma contact@arjunchoudhary.com

commit: bf657de parent: 2693659
1 files changed, 2 insertions(+), 14 deletions(-)
Mstagit.c+2-14
M · stagit.c +2, -14
 1@@ -46,11 +46,6 @@ struct commitinfo {
 2 	size_t ndeltas;
 3 };
 4 
 5-/* summary length (bytes) in the log */
 6-static const unsigned summarylen = 70;
 7-/* display line count or file size in file tree index */
 8-static const int showlinecount = 1;
 9-
10 static git_repository *repo;
11 
12 static const char *relpath = "";
13@@ -537,20 +532,13 @@ printshowfile(FILE *fp, struct commitinfo *ci)
14 void
15 writelogline(FILE *fp, struct commitinfo *ci)
16 {
17-	size_t len;
18-
19 	fputs("<tr><td>", fp);
20 	if (ci->author)
21 		printtimeshort(fp, &(ci->author->when));
22 	fputs("</td><td>", fp);
23 	if (ci->summary) {
24 		fprintf(fp, "<a href=\"%scommit/%s.html\">", relpath, ci->oid);
25-		if ((len = strlen(ci->summary)) > summarylen) {
26-			xmlencode(fp, ci->summary, summarylen - 1);
27-			fputs("…", fp);
28-		} else {
29-			xmlencode(fp, ci->summary, len);
30-		}
31+		xmlencode(fp, ci->summary, strlen(ci->summary));
32 		fputs("</a>", fp);
33 	}
34 	fputs("</td><td>", fp);
35@@ -836,7 +824,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path)
36 			fprintf(fp, "</td><td><a href=\"%s%s\">", relpath, filepath);
37 			xmlencode(fp, entrypath, strlen(entrypath));
38 			fputs("</a></td><td class=\"num\" align=\"right\">", fp);
39-			if (showlinecount && lc > 0)
40+			if (lc > 0)
41 				fprintf(fp, "%dL", lc);
42 			else
43 				fprintf(fp, "%juB", (uintmax_t)filesize);