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

[PATCH 2/2] log: print log entry terminator even if the message is empty

From
Adam Simpkins <adam@adamsimpkins.net>
Date
Apr 29, 2008, 08:33 UTC
Message-ID
<1209457980-19677-2-git-send-email-adam@adamsimpkins.net>
In-Reply-To
<1209457980-19677-1-git-send-email-adam@adamsimpkins.net>

This eliminates a special case in the show_log() function, to help simplify the terminator semantics. Now show_log() always prints a newline after the log entry when use_terminator is set, even if the log message is empty.

This change should only affect the --pretty=tformat output, since that was the only way to trigger this special case.

Signed-off-by: Adam Simpkins <adam@adamsimpkins.net>
---
 log-tree.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/log-tree.c b/log-tree.c
index 4c7d7ef..74b79b5 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -307,11 +307,9 @@ void show_log(struct rev_info *opt)
 	if (opt->show_log_size)
 		printf("log size %i\n", (int)msgbuf.len);
 
-	if (msgbuf.len) {
-		fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
-		if (opt->use_terminator)
-			putchar('\n');
-	}
+	fwrite(msgbuf.buf, sizeof(char), msgbuf.len, stdout);
+	if (opt->use_terminator)
+		putchar('\n');
 	strbuf_release(&msgbuf);
 }
 
-- 
1.5.3.6
Previous: Adam Simpkins
Message 2 of 2 in “Remove dead code: show_log() sep argument and diff_options.msg_sep”
  1. 1/2 Remove dead code: show_log() sep argument and diff_options.msg_sepAdam Simpkins, Apr 29, 2008
  2. 2/2 log: print log entry terminator even if the message is emptyAdam Simpkins, Apr 29, 2008

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.