X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=commit.c;h=93b3903ea78fac0b5a40074ec64d0c98bb8cfa94;hb=596524b33d50e47e2375cec9e00aff59f0e8278b;hp=af747bde61d8330716e77a4a6db2839d9f8b59c5;hpb=3eefc189172b88dece6fb6d479b3ed13cc483dbc;p=git.git diff --git a/commit.c b/commit.c index af747bde..93b3903e 100644 --- a/commit.c +++ b/commit.c @@ -442,7 +442,8 @@ static int add_user_info(const char *what, enum cmit_fmt fmt, char *buf, const c ret += sprintf(buf + ret, "Date: %s\n", show_date(time, tz)); break; case CMIT_FMT_EMAIL: - ret += sprintf(buf + ret, "Date: %s\n", show_date(time, tz)); + ret += sprintf(buf + ret, "Date: %s\n", + show_rfc2822_date(time, tz)); break; case CMIT_FMT_FULLER: ret += sprintf(buf + ret, "%sDate: %s\n", what, show_date(time, tz)); @@ -488,17 +489,14 @@ static int add_merge_info(enum cmit_fmt fmt, char *buf, const struct commit *com return offset; } -unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit, unsigned long len, char *buf, unsigned long space, int abbrev) +unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit, unsigned long len, char *buf, unsigned long space, int abbrev, const char *subject) { int hdr = 1, body = 0; unsigned long offset = 0; int indent = 4; int parents_shown = 0; const char *msg = commit->buffer; - const char *subject = NULL; - if (fmt == CMIT_FMT_EMAIL) - subject = "Subject: "; if (fmt == CMIT_FMT_ONELINE || fmt == CMIT_FMT_EMAIL) indent = 0; @@ -574,8 +572,9 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit } if (subject) { - memcpy(buf + offset, subject, 9); - offset += 9; + int slen = strlen(subject); + memcpy(buf + offset, subject, slen); + offset += slen; } memset(buf + offset, ' ', indent); memcpy(buf + offset + indent, line, linelen);