diff options
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -549,7 +549,7 @@ static void add_merge_info(const struct pretty_print_context *pp, struct object_id *oidp = &parent->item->object.oid; strbuf_addch(sb, ' '); if (pp->abbrev) - strbuf_add_unique_abbrev(sb, oidp->hash, pp->abbrev); + strbuf_add_unique_abbrev(sb, oidp, pp->abbrev); else strbuf_addstr(sb, oid_to_hex(oidp)); parent = parent->next; @@ -630,7 +630,7 @@ const char *logmsg_reencode(const struct commit *commit, * the cached copy from get_commit_buffer, we need to duplicate it * to avoid munging the cached copy. */ - if (msg == get_cached_commit_buffer(commit, NULL)) + if (msg == get_cached_commit_buffer(the_repository, commit, NULL)) out = xstrdup(msg); else out = (char *)msg; @@ -1146,7 +1146,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ /* these depend on the commit */ if (!commit->object.parsed) - parse_object(&commit->object.oid); + parse_object(the_repository, &commit->object.oid); switch (placeholder[0]) { case 'H': /* commit hash */ @@ -1156,15 +1156,16 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ return 1; case 'h': /* abbreviated commit hash */ strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_COMMIT)); - strbuf_add_unique_abbrev(sb, commit->object.oid.hash, + strbuf_add_unique_abbrev(sb, &commit->object.oid, c->pretty_ctx->abbrev); strbuf_addstr(sb, diff_get_color(c->auto_color, DIFF_RESET)); return 1; case 'T': /* tree hash */ - strbuf_addstr(sb, oid_to_hex(&commit->tree->object.oid)); + strbuf_addstr(sb, oid_to_hex(get_commit_tree_oid(commit))); return 1; case 't': /* abbreviated tree hash */ - strbuf_add_unique_abbrev(sb, commit->tree->object.oid.hash, + strbuf_add_unique_abbrev(sb, + get_commit_tree_oid(commit), c->pretty_ctx->abbrev); return 1; case 'P': /* parent hashes */ @@ -1178,7 +1179,7 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ for (p = commit->parents; p; p = p->next) { if (p != commit->parents) strbuf_addch(sb, ' '); - strbuf_add_unique_abbrev(sb, p->item->object.oid.hash, + strbuf_add_unique_abbrev(sb, &p->item->object.oid, c->pretty_ctx->abbrev); } return 1; @@ -1255,6 +1256,14 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ if (c->signature_check.key) strbuf_addstr(sb, c->signature_check.key); break; + case 'F': + if (c->signature_check.fingerprint) + strbuf_addstr(sb, c->signature_check.fingerprint); + break; + case 'P': + if (c->signature_check.primary_key_fingerprint) + strbuf_addstr(sb, c->signature_check.primary_key_fingerprint); + break; default: return 0; } @@ -1303,6 +1312,9 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ if (skip_prefix(placeholder, "(trailers", &arg)) { struct process_trailer_options opts = PROCESS_TRAILER_OPTIONS_INIT; + + opts.no_divider = 1; + if (*arg == ':') { arg++; for (;;) { @@ -1537,7 +1549,7 @@ void format_commit_message(const struct commit *commit, } if (output_enc) { - int outsz; + size_t outsz; char *out = reencode_string_len(sb->buf, sb->len, output_enc, utf8, &outsz); if (out) @@ -1574,7 +1586,7 @@ static void pp_header(struct pretty_print_context *pp, } if (starts_with(line, "parent ")) { - if (linelen != 48) + if (linelen != the_hash_algo->hexsz + 8) die("bad parent line in commit"); continue; } @@ -1582,7 +1594,7 @@ static void pp_header(struct pretty_print_context *pp, if (!parents_shown) { unsigned num = commit_list_count(commit->parents); /* with enough slop */ - strbuf_grow(sb, num * 50 + 20); + strbuf_grow(sb, num * (GIT_MAX_HEXSZ + 10) + 20); add_merge_info(pp, sb, commit); parents_shown = 1; } |