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 коммит произвёл Junio C Hamano
Родитель 8babab95af
Коммит a98b819183
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

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