shithub: git9

Download patch

ref: c9070ab9a346da79bc978807f4a3c83de2176cb9
parent: 470632864bf1cb0f48cf577a0ad8186cd673d735
author: Michael Forney <mforney@mforney.org>
date: Mon Feb 8 01:22:34 EST 2021

git/log: fix formatting of commit messages with multibyte characters

--- a/log.c
+++ b/log.c
@@ -146,7 +146,9 @@
 		p = o->commit->msg;
 		e = p + o->commit->nmsg;
 		q = nextline(p, e);
-		Bprint(out, "%H %.*s\n", o->hash, (int)(q - p), p);
+		Bprint(out, "%H ", o->hash);
+		Bwrite(out, p, q - p);
+		Bputc(out, '\n');
 	}else{
 		tmtime(&tm, o->commit->mtime, tzload("local"));
 		Bprint(out, "Hash:\t%H\n", o->hash);
@@ -157,7 +159,9 @@
 		e = p + o->commit->nmsg;
 		for(; p != e; p = q){
 			q = nextline(p, e);
-			Bprint(out, "\t%.*s\n", (int)(q - p), p);
+			Bputc(out, '\t');
+			Bwrite(out, p, q - p);
+			Bputc(out, '\n');
 			if(q != e)
 				q++;
 		}