Skip to content

Commit a98b819

Browse files
Kristian Høgsberggitster
authored andcommitted
Fix off-by-one error when truncating the diff out of the commit message.
Signed-off-by: Kristian Høgsberg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8babab9 commit a98b819

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin-commit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
765765
/* Truncate the message just before the diff, if any. */
766766
p = strstr(sb.buf, "\ndiff --git a/");
767767
if (p != NULL)
768-
strbuf_setlen(&sb, p - sb.buf);
768+
strbuf_setlen(&sb, p - sb.buf + 1);
769769

770770
stripspace(&sb, 1);
771771
if (sb.len < header_len || message_is_empty(&sb, header_len)) {

0 commit comments

Comments
 (0)