From 0efae3b22e7472b95174632c323137a2b21b9c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 15 Apr 2013 12:24:08 +0200 Subject: commit: correctly detect the start of the commit message The end of the header is signaled by to consecutive LFs and the commit message starts immediately after. Jumping over LFs at the start of the message is a bug and leads to creating different commits if when rebuilding history. This also fixes an empty commit message being returned as "\n". --- src/commit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/commit.c') diff --git a/src/commit.c b/src/commit.c index e2d3d346b..c7b83ed43 100644 --- a/src/commit.c +++ b/src/commit.c @@ -189,8 +189,8 @@ int git_commit__parse_buffer(git_commit *commit, const void *data, size_t len) buffer = eoln; } - /* skip blank lines */ - while (buffer < buffer_end - 1 && *buffer == '\n') + /* buffer is now at the end of the header, double-check and move forward into the message */ + if (buffer < buffer_end && *buffer == '\n') buffer++; /* parse commit message */ -- cgit v1.2.1