92
{ "medium", CMIT_FMT_MEDIUM, 0, 8 },
93
{ "short", CMIT_FMT_SHORT, 0, 0 },
94
{ "email", CMIT_FMT_EMAIL, 0, 0 },
95
+ { "mboxrd", CMIT_FMT_MBOXRD, 0, 0 },
96
{ "fuller", CMIT_FMT_FULLER, 0, 8 },
97
{ "full", CMIT_FMT_FULL, 0, 8 },
98
{ "oneline", CMIT_FMT_ONELINE, 1, 0 }
445
if (pp->mailmap)
446
map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen);
447
447
- if (pp->fmt == CMIT_FMT_EMAIL) {
448
+ if (cmit_fmt_is_mail(pp->fmt)) {
449
if (pp->from_ident && ident_cmp(pp->from_ident, &ident)) {
450
struct strbuf buf = STRBUF_INIT;
451
495
show_ident_date(&ident, &pp->date_mode));
496
break;
497
case CMIT_FMT_EMAIL:
498
+ case CMIT_FMT_MBOXRD:
499
strbuf_addf(sb, "Date: %s\n",
500
show_ident_date(&ident, DATE_MODE(RFC2822)));
501
break;
537
{
538
struct commit_list *parent = commit->parents;
539
538
- if ((pp->fmt == CMIT_FMT_ONELINE) || (pp->fmt == CMIT_FMT_EMAIL) ||
540
+ if ((pp->fmt == CMIT_FMT_ONELINE) || (cmit_fmt_is_mail(pp->fmt)) ||
541
!parent || !parent->next)
542
return;
543
1616
if (pp->after_subject) {
1617
strbuf_addstr(sb, pp->after_subject);
1618
}
1617
- if (pp->fmt == CMIT_FMT_EMAIL) {
1619
+ if (cmit_fmt_is_mail(pp->fmt)) {
1620
strbuf_addch(sb, '\n');
1621
}
1622
1699
strbuf_add(sb, line, linelen);
1700
}
1701
1702
+static int is_mboxrd_from(const char *line, int len)
1703
+{
1704
+ /*
1705
+ * a line matching /^From $/ here would only have len == 4
1706
+ * at this point because is_empty_line would've trimmed all
1707
+ * trailing space
1708
+ */
1709
+ return len > 4 && starts_with(line + strspn(line, ">"), "From ");
1710
+}
1711
+
1712
void pp_remainder(struct pretty_print_context *pp,
1713
const char **msg_p,
1714
struct strbuf *sb,
1737
else if (pp->expand_tabs_in_log)
1738
strbuf_add_tabexpand(sb, pp->expand_tabs_in_log,
1739
line, linelen);
1728
- else
1740
+ else {
1741
+ if (pp->fmt == CMIT_FMT_MBOXRD &&
1742
+ is_mboxrd_from(line, linelen))
1743
+ strbuf_addch(sb, '>');
1744
+
1745
strbuf_add(sb, line, linelen);
1746
+ }
1747
strbuf_addch(sb, '\n');
1748
}
1749
}
1767
encoding = get_log_output_encoding();
1768
msg = reencoded = logmsg_reencode(commit, NULL, encoding);
1769
1753
- if (pp->fmt == CMIT_FMT_ONELINE || pp->fmt == CMIT_FMT_EMAIL)
1770
+ if (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))
1771
indent = 0;
1772
1773
/*
1774
* We need to check and emit Content-type: to mark it
1775
* as 8-bit if we haven't done so.
1776
*/
1760
- if (pp->fmt == CMIT_FMT_EMAIL && need_8bit_cte == 0) {
1777
+ if (cmit_fmt_is_mail(pp->fmt) && need_8bit_cte == 0) {
1778
int i, ch, in_body;
1779
1780
for (in_body = i = 0; (ch = msg[i]); i++) {
1802
msg = skip_empty_lines(msg);
1803
1804
/* These formats treat the title line specially. */
1788
- if (pp->fmt == CMIT_FMT_ONELINE || pp->fmt == CMIT_FMT_EMAIL)
1805
+ if (pp->fmt == CMIT_FMT_ONELINE || cmit_fmt_is_mail(pp->fmt))
1806
pp_title_line(pp, &msg, sb, encoding, need_8bit_cte);
1807
1808
beginning_of_body = sb->len;
1819
* format. Make sure we did not strip the blank line
1820
* between the header and the body.
1821
*/
1805
- if (pp->fmt == CMIT_FMT_EMAIL && sb->len <= beginning_of_body)
1822
+ if (cmit_fmt_is_mail(pp->fmt) && sb->len <= beginning_of_body)
1823
strbuf_addch(sb, '\n');
1824
1825
unuse_commit_buffer(commit, reencoded);