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>
This commit is contained in:
Kristian Høgsberg 2007-11-26 10:16:08 -05:00 committed by Junio C Hamano
parent 8babab95af
commit a98b819183

View 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)) {