From 7cb669f74f6aeacdbc092267c690624032073eec Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 7 May 2017 12:02:48 +0200 Subject: [PATCH] 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. --- stagit.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/stagit.c b/stagit.c index 5eb5f1c..d310a58 100644 --- a/stagit.c +++ b/stagit.c @@ -46,11 +46,6 @@ struct commitinfo { size_t ndeltas; }; -/* summary length (bytes) in the log */ -static const unsigned summarylen = 70; -/* display line count or file size in file tree index */ -static const int showlinecount = 1; - static git_repository *repo; static const char *relpath = ""; @@ -537,20 +532,13 @@ printshowfile(FILE *fp, struct commitinfo *ci) void writelogline(FILE *fp, struct commitinfo *ci) { - size_t len; - fputs("", fp); if (ci->author) printtimeshort(fp, &(ci->author->when)); fputs("", fp); if (ci->summary) { fprintf(fp, "", relpath, ci->oid); - if ((len = strlen(ci->summary)) > summarylen) { - xmlencode(fp, ci->summary, summarylen - 1); - fputs("…", fp); - } else { - xmlencode(fp, ci->summary, len); - } + xmlencode(fp, ci->summary, strlen(ci->summary)); fputs("", fp); } fputs("", fp); @@ -836,7 +824,7 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) fprintf(fp, "", relpath, filepath); xmlencode(fp, entrypath, strlen(entrypath)); fputs("", fp); - if (showlinecount && lc > 0) + if (lc > 0) fprintf(fp, "%dL", lc); else fprintf(fp, "%juB", (uintmax_t)filesize); -- libgit2 1.1.1