Skip to content

Commit

Permalink
Fix off-by-one error when truncating the diff out of the commit message.
Browse files Browse the repository at this point in the history
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kristian Høgsberg authored and Junio C Hamano committed Nov 26, 2007
1 parent 8babab9 commit a98b819
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit a98b819

Please sign in to comment.