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>
Kristian Høgsberg committed
Nov 26, 2007 at 10:16 UTC
a98b819183820cf87f1073c36b57883cb05e7049
1 file changed
+1
-1
builtin-commit.c
+1
-1
@@ -765,7 +765,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
765
/* Truncate the message just before the diff, if any. */
766
p = strstr(sb.buf, "\ndiff --git a/");
767
if (p != NULL)
768
- strbuf_setlen(&sb, p - sb.buf);
768
+ strbuf_setlen(&sb, p - sb.buf + 1);
769
770
stripspace(&sb, 1);
771
if (sb.len < header_len || message_is_empty(&sb, header_len)) {