threads / patch / 1048

patchHandle commit messages without new line at end correctly

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

## tl;dr

One message between Jun 29, 2005 and Jun 29, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Fredrik Kuivinen· Jun 29, 2005, 21:24 UTC · lore

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>
---
Show changes to commit.c +2 −2
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;
 }

← back to recent threads