Fix off-by-one error when truncating the diff out of the commit message.
authorKristian Høgsberg <krh@redhat.com>
Mon, 26 Nov 2007 15:16:08 +0000 (10:16 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Nov 2007 17:14:49 +0000 (09:14 -0800)
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-commit.c
index f60bd7f4dce5848ae4993753e01f88de98b391da..a35881e20b2ba8a71a047a2a264e496ceb56ff05 100644 (file)
@@ -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)) {