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

[PATCH] Handle commit messages without new line at end correctly

From
Fredrik Kuivinen <freku045@student.liu.se>
Date
Jun 29, 2005, 21:24 UTC
Message-ID
<20050629212437.GA14683@c165.ib.student.liu.se>

Currently, if a commit message doesn't end with a new line the last line in the message is omitted from the output. The following patch fixes this bug.

Signed-Off-By: Fredrik Kuivinen <freku045@student.liu.se>
---
diff --git a/commit.c b/commit.c
--- a/commit.c
+++ b/commit.c
@@ -202,11 +202,11 @@ static int get_one_line(const char *msg,
 
 	while (len--) {
 		char c = *msg++;
+		if (!c)
+			break;
 		ret++;
 		if (c == '\n')
 			break;
-		if (!c)
-			return 0;
 	}
 	return ret;
 }
Message 1 of 1 in “Handle commit messages without new line at end correctly”
  1. Handle commit messages without new line at end correctlyFredrik Kuivinen, Jun 29, 2005

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.