{"thread":{"id":"4877","subject":"[PATCH] format-patch: Generate a newline between the subject header and the message body","startedAt":"2006-07-13T22:17:22Z","lastAt":"2006-07-13T22:17:22Z","messageCount":1,"participants":["Robert Shearman"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23787","messageId":"44B6C672.9090300@codeweavers.com","threadId":"4877","inReplyTo":null,"subject":"[PATCH] format-patch: Generate a newline between the subject header and the message body","fromName":"Robert Shearman","fromEmail":"rob@codeweavers.com","sentAt":"2006-07-13T22:17:22Z","receivedAt":"2006-07-13T22:17:22Z","isPatch":true,"sender":{"key":"robertshearman@gmail.com","avatar":null},"body":"\nformat-patch previously didn't generate a newline after a subject. This \ncaused the diffstat to not be displayed in messages with only one line \nfor the commit message.\nThis patch fixes this by adding a newline after the headers if a body \nhasn't been added.\nSigned-off-by: Robert Shearman <rob@codeweavers.com>\n---\n  commit.c |   11 +++++++++--\n  1 files changed, 9 insertions(+), 2 deletions(-)\n\n\ndiff --git a/commit.c b/commit.c\nindex 522a6f3..6ac3bf7 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -655,6 +655,9 @@ unsigned long pretty_print_commit(enum c\n \t\t\tcontinue;\n \t\t}\n \n+\t\tif (!subject)\n+\t\t\tbody = 1;\n+\n \t\tif (is_empty_line(line, &linelen)) {\n \t\t\tif (!body)\n \t\t\t\tcontinue;\n@@ -662,8 +665,6 @@ unsigned long pretty_print_commit(enum c\n \t\t\t\tcontinue;\n \t\t\tif (fmt == CMIT_FMT_SHORT)\n \t\t\t\tbreak;\n-\t\t} else {\n-\t\t\tbody = 1;\n \t\t}\n \n \t\tif (subject) {\n@@ -702,6 +703,12 @@ unsigned long pretty_print_commit(enum c\n \t/* Make sure there is an EOLN for the non-oneline case */\n \tif (fmt != CMIT_FMT_ONELINE)\n \t\tbuf[offset++] = '\\n';\n+\t/*\n+\t * make sure there is another EOLN to separate the headers from whatever\n+\t * body the caller appends if we haven't already written a body\n+\t */\n+\tif (fmt == CMIT_FMT_EMAIL && !body)\n+\t\tbuf[offset++] = '\\n';\n \tbuf[offset] = '\\0';\n \treturn offset;\n }\n\n"}]}