From: Junio C Hamano Date: Sat, 10 Oct 2009 00:57:20 GMT Subject: Re: [PATCHv4] git-log --format: Add %B tag with %B(n) option Message-ID: <7vzl80dq1b.fsf@alter.siamese.dyndns.org> In-Reply-To: <1253655038-20335-1-git-send-email-heipei@hackvalue.de> Johannes Gilger writes: > diff --git a/pretty.c b/pretty.c > index f5983f8..dafa8e0 100644 > --- a/pretty.c > +++ b/pretty.c > @@ -605,13 +605,17 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder, > int h1, h2; > > /* these are independent of the commit */ > + > + const char *body = msg + c->body_off; > + const char *end = NULL; Unfortunately, c->body_off is not valid until you make a call to parse_commit_message(). Obviously, body is used only after such a call is made in the original, so I fixed this initialization into an explicit assignment after the call.