From: Kristian Høgsberg <krh@redhat.com>
Date: Mon, 26 Nov 2007 15:16:08 +0000 (-0500)
Subject: Fix off-by-one error when truncating the diff out of the commit message.
X-Git-Tag: v1.5.4-rc0~78^2~8
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a98b819183820cf87f1073c36b57883cb05e7049;p=git.git

Fix off-by-one error when truncating the diff out of the commit message.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

diff --git a/builtin-commit.c b/builtin-commit.c
index f60bd7f4d..a35881e20 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -765,7 +765,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	/* Truncate the message just before the diff, if any. */
 	p = strstr(sb.buf, "\ndiff --git a/");
 	if (p != NULL)
-		strbuf_setlen(&sb, p - sb.buf);
+		strbuf_setlen(&sb, p - sb.buf + 1);
 
 	stripspace(&sb, 1);
 	if (sb.len < header_len || message_is_empty(&sb, header_len)) {