git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] pretty.c: use original commit message if reencoding fails

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 23, 2011, 11:51 UTC
Message-ID
<1319370695-12638-2-git-send-email-pclouds@gmail.com>
In-Reply-To
<1319370695-12638-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 pretty.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/pretty.c b/pretty.c
index 375ff7b..230fe1c 100644
--- a/pretty.c
+++ b/pretty.c
@@ -1103,8 +1103,11 @@ void format_commit_message(const struct commit *commit,
 	context.message = commit->buffer;
 	if (output_enc) {
 		char *enc = get_header(commit, "encoding");
-		if (strcmp(enc ? enc : utf8, output_enc))
+		if (strcmp(enc ? enc : utf8, output_enc)) {
 			context.message = logmsg_reencode(commit, output_enc);
+			if (!context.message)
+				context.message = commit->buffer;
+		}
 		free(enc);
 	}
 
-- 
1.7.3.1.256.g2539c.dirty
Previous: Nguyễn Thái Ngọc Duy
Message 2 of 2 in “pretty.c: free get_header() return value”
  1. 1/2 pretty.c: free get_header() return valueNguyễn Thái Ngọc Duy, Oct 23, 2011
  2. 2/2 pretty.c: use original commit message if reencoding failsNguyễn Thái Ngọc Duy, Oct 23, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.