summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-04-15 12:24:08 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-04-15 12:24:08 +0200
commit0efae3b22e7472b95174632c323137a2b21b9c51 (patch)
tree2c41d4ca3f9f27bf105ea0d9819f15b541d6c646 /src
parent041ed367ab026583d6607b5029a0c63146a90215 (diff)
downloadlibgit2-0efae3b22e7472b95174632c323137a2b21b9c51.tar.gz
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".
Diffstat (limited to 'src')
-rw-r--r--src/commit.c4
1 files changed, 2 insertions, 2 deletions
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 */