diff options
author | Robert Shearman <rob@codeweavers.com> | 2006-07-13 23:17:22 +0100 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-07-13 21:40:43 -0700 |
commit | 19b3bd3e2d260323c5e727212a6dcd7fc0f7aa07 (patch) | |
tree | e9a765ab286241bac3997a472bc964f9b043505a /commit.c | |
parent | a40d384caca008c0334a35e9ac298f2eeb5decd2 (diff) | |
download | git-19b3bd3e2d260323c5e727212a6dcd7fc0f7aa07.tar.gz |
format-patch: Generate a newline between the subject header and the message body
format-patch previously didn't generate a newline after a subject. This
caused the diffstat to not be displayed in messages with only one line
for the commit message.
This patch fixes this by adding a newline after the headers if a body
hasn't been added.
Signed-off-by: Robert Shearman <rob@codeweavers.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -655,6 +655,9 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit continue; } + if (!subject) + body = 1; + if (is_empty_line(line, &linelen)) { if (!body) continue; @@ -662,8 +665,6 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit continue; if (fmt == CMIT_FMT_SHORT) break; - } else { - body = 1; } if (subject) { @@ -702,6 +703,12 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit /* Make sure there is an EOLN for the non-oneline case */ if (fmt != CMIT_FMT_ONELINE) buf[offset++] = '\n'; + /* + * make sure there is another EOLN to separate the headers from whatever + * body the caller appends if we haven't already written a body + */ + if (fmt == CMIT_FMT_EMAIL && !body) + buf[offset++] = '\n'; buf[offset] = '\0'; return offset; } |