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

1 messages from 2005-06-29 to 2005-06-29. Participants: Fredrik Kuivinen.
Thread: https://gitlist.dev/t/1048

## Fredrik Kuivinen, 2005-06-29 21:24

Subject: [PATCH] Handle commit messages without new line at end correctly
Message-ID: <20050629212437.GA14683@c165.ib.student.liu.se>
URL: https://gitlist.dev/e/20050629212437.GA14683%40c165.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;
 }

```
