X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=pretty.c;h=8b18efda9cd6eb615900687c0205daa832794c92;hb=ce987457ca3db0c78d5e720f753adf210fd3dd65;hp=aaf80207c94e18524559b65e7bb9aff97513faa8;hpb=8028184eecf1051e4b39b308a3ad909eed1371c4;p=git.git diff --git a/pretty.c b/pretty.c index aaf80207c..8b18efda9 100644 --- a/pretty.c +++ b/pretty.c @@ -59,6 +59,7 @@ static int git_pretty_formats_config(const char *var, const char *value, void *c ALLOC_GROW(commit_formats, commit_formats_len+1, commit_formats_alloc); commit_format = &commit_formats[commit_formats_len]; + memset(commit_format, 0, sizeof(*commit_format)); commit_formats_len++; } @@ -823,7 +824,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder, if (add_again(sb, &c->abbrev_commit_hash)) return 1; strbuf_addstr(sb, find_unique_abbrev(commit->object.sha1, - DEFAULT_ABBREV)); + c->pretty_ctx->abbrev)); c->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off; return 1; case 'T': /* tree hash */ @@ -833,7 +834,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder, if (add_again(sb, &c->abbrev_tree_hash)) return 1; strbuf_addstr(sb, find_unique_abbrev(commit->tree->object.sha1, - DEFAULT_ABBREV)); + c->pretty_ctx->abbrev)); c->abbrev_tree_hash.len = sb->len - c->abbrev_tree_hash.off; return 1; case 'P': /* parent hashes */ @@ -850,7 +851,8 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder, if (p != commit->parents) strbuf_addch(sb, ' '); strbuf_addstr(sb, find_unique_abbrev( - p->item->object.sha1, DEFAULT_ABBREV)); + p->item->object.sha1, + c->pretty_ctx->abbrev)); } c->abbrev_parent_hashes.len = sb->len - c->abbrev_parent_hashes.off; @@ -907,6 +909,10 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder, case 'e': /* encoding */ strbuf_add(sb, msg + c->encoding.off, c->encoding.len); return 1; + case 'B': /* raw body */ + /* message_off is always left at the initial newline */ + strbuf_addstr(sb, msg + c->message_off + 1); + return 1; } /* Now we need to parse the commit message. */