Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pretty.c')
-rw-r--r--pretty.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/pretty.c b/pretty.c
index 25efbcac92..5e683830d9 100644
--- a/pretty.c
+++ b/pretty.c
@@ -10,6 +10,7 @@
#include "color.h"
#include "reflog-walk.h"
#include "gpg-interface.h"
+#include "trailer.h"
static char *user_format;
static struct cmt_fmt_map {
@@ -544,15 +545,13 @@ static void add_merge_info(const struct pretty_print_context *pp,
strbuf_addstr(sb, "Merge:");
while (parent) {
- struct commit *p = parent->item;
- const char *hex = NULL;
+ struct object_id *oidp = &parent->item->object.oid;
+ strbuf_addch(sb, ' ');
if (pp->abbrev)
- hex = find_unique_abbrev(p->object.oid.hash, pp->abbrev);
- if (!hex)
- hex = oid_to_hex(&p->object.oid);
+ strbuf_add_unique_abbrev(sb, oidp->hash, pp->abbrev);
+ else
+ strbuf_addstr(sb, oid_to_hex(oidp));
parent = parent->next;
-
- strbuf_addf(sb, " %s", hex);
}
strbuf_addch(sb, '\n');
}
@@ -891,6 +890,16 @@ const char *format_subject(struct strbuf *sb, const char *msg,
return msg;
}
+static void format_trailers(struct strbuf *sb, const char *msg)
+{
+ struct trailer_info info;
+
+ trailer_info_get(&info, msg);
+ strbuf_add(sb, info.trailer_start,
+ info.trailer_end - info.trailer_start);
+ trailer_info_release(&info);
+}
+
static void parse_commit_message(struct format_commit_context *c)
{
const char *msg = c->message + c->message_off;
@@ -1232,8 +1241,12 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
switch (c->signature_check.result) {
case 'G':
case 'B':
+ case 'E':
case 'U':
case 'N':
+ case 'X':
+ case 'Y':
+ case 'R':
strbuf_addch(sb, c->signature_check.result);
}
break;
@@ -1290,6 +1303,12 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
strbuf_addstr(sb, msg + c->body_off);
return 1;
}
+
+ if (starts_with(placeholder, "(trailers)")) {
+ format_trailers(sb, msg + c->subject_off);
+ return strlen("(trailers)");
+ }
+
return 0; /* unknown placeholder */
}