{"thread":{"id":"4870","subject":"[PATCH] format-patch: Generate a newline between the subject header and the message body.","startedAt":"2006-07-13T12:03:41Z","lastAt":"2006-07-13T21:55:30Z","messageCount":6,"participants":["Robert Shearman","Jakub Narebski","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"23759","messageId":"44B6369D.6070602@codeweavers.com","threadId":"4870","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-13T12:03:41Z","receivedAt":"2006-07-13T12:03:41Z","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 without a blank line \nand the first blank line to be eaten in messages with a blank line.\n\nThis patch inserts a newline in two places - once in the loop to \nseparate the subject part of the commit message from the body part of \nthe commit message and another after the loop to counteract the eating \nof whitespace at the end of the message.\n---\n  commit.c |   14 ++++++++++++--\n  1 files changed, 12 insertions(+), 2 deletions(-)\n\n\ndiff --git a/commit.c b/commit.c\nindex 522a6f3..8869b0d 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@@ -694,6 +695,9 @@ unsigned long pretty_print_commit(enum c\n \t\t\tmemcpy(buf + offset, after_subject, slen);\n \t\t\toffset += slen;\n \t\t\tafter_subject = NULL;\n+\t\t} else if (fmt == CMIT_FMT_EMAIL && subject) {\n+\t\t\t/* separate the headers from the body */\n+\t\t\tbuf[offset++] = '\\n';\n \t\t}\n \t\tsubject = NULL;\n \t}\n@@ -702,6 +706,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"},{"id":"23771","messageId":"e967en$bi6$1@sea.gmane.org","threadId":"4870","inReplyTo":"44B6369D.6070602@codeweavers.com","subject":"Re: [PATCH] format-patch: Generate a newline between the subject header and the message body.","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2006-07-13T19:38:48Z","receivedAt":"2006-07-13T19:38:48Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Robert Shearman wrote:\n\n> \n> format-patch previously didn't generate a newline after a subject. This \n> caused the diffstat to not be displayed in messages without a blank line \n> and the first blank line to be eaten in messages with a blank line.\n\nDoes this _enforce_ separating commit message into subject+empty\nline+description? What about commit messages without this structire (e.g.\nlegacy commit messages from import from other SCM, e.g. GNU ChangeLog\nstyle)?\n\n-- \nJakub Narebski\nWarsaw, Poland\nShadeHawk on #git\n"},{"id":"23772","messageId":"44B6A70E.7060301@codeweavers.com","threadId":"4870","inReplyTo":"e967en$bi6$1@sea.gmane.org","subject":"Re: [PATCH] format-patch: Generate a newline between the subject header and the message body.","fromName":"Robert Shearman","fromEmail":"rob@codeweavers.com","sentAt":"2006-07-13T20:03:26Z","receivedAt":"2006-07-13T20:03:26Z","isPatch":true,"sender":{"key":"robertshearman@gmail.com","avatar":null},"body":"Jakub Narebski wrote:\n\n>Robert Shearman wrote:\n>  \n>\n>>format-patch previously didn't generate a newline after a subject. This \n>>caused the diffstat to not be displayed in messages without a blank line \n>>and the first blank line to be eaten in messages with a blank line.\n>>    \n>>\n>\n>Does this _enforce_ separating commit message into subject+empty\n>line+description? What about commit messages without this structire (e.g.\n>legacy commit messages from import from other SCM, e.g. GNU ChangeLog\n>style)?\n>\n\nIt only affects commits exported into email style. It has nothing to do\nwith the structure of GIT commit messages or those of any other SCM.\n\n-- \nRob Shearman\n"},{"id":"23780","messageId":"7vbqrtur8q.fsf@assigned-by-dhcp.cox.net","threadId":"4870","inReplyTo":"44B6369D.6070602@codeweavers.com","subject":"Re: [PATCH] format-patch: Generate a newline between the subject header and the message body.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-13T21:31:01Z","receivedAt":"2006-07-13T21:31:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Robert Shearman <rob@codeweavers.com> writes:\n\n> This patch inserts a newline in two places - once in the loop to\n> separate the subject part of the commit message from the body part of\n> the commit message and another after the loop to counteract the eating\n> of whitespace at the end of the message.\n\nThanks.\n\n * Please sign your patch.\n\n * This breaks a handful t4013 tests, but all in a good way (in\n   other words, the expected output files were wrong).\n\nI'll fix up the t/t4013/diff.* files myself.\n"},{"id":"23783","messageId":"7v7j2huqfj.fsf@assigned-by-dhcp.cox.net","threadId":"4870","inReplyTo":"7vbqrtur8q.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] format-patch: Generate a newline between the subject header and the message body.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-07-13T21:48:32Z","receivedAt":"2006-07-13T21:48:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Robert Shearman <rob@codeweavers.com> writes:\n>\n>> This patch inserts a newline in two places - once in the loop to\n>> separate the subject part of the commit message from the body part of\n>> the commit message and another after the loop to counteract the eating\n>> of whitespace at the end of the message.\n>\n> Thanks.\n>\n>  * Please sign your patch.\n>\n>  * This breaks a handful t4013 tests, but all in a good way (in\n>    other words, the expected output files were wrong).\n>\n> I'll fix up the t/t4013/diff.* files myself.\n\nActually, I take that back.  This breaks normal commit log\nmessages by adding extra blank lines.  The extra LF is needed\nwhen the commit log does not have any message (just title).\n\nI'll be tweaking a few tests in t4013 to catch future breakage\nof this kind.\n"},{"id":"23786","messageId":"44B6C152.8000204@codeweavers.com","threadId":"4870","inReplyTo":"7v7j2huqfj.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] format-patch: Generate a newline between the subject header and the message body.","fromName":"Robert Shearman","fromEmail":"rob@codeweavers.com","sentAt":"2006-07-13T21:55:30Z","receivedAt":"2006-07-13T21:55:30Z","isPatch":true,"sender":{"key":"robertshearman@gmail.com","avatar":null},"body":"Junio C Hamano wrote:\n\n>Junio C Hamano <junkio@cox.net> writes:\n>\n>  \n>\n>>Robert Shearman <rob@codeweavers.com> writes:\n>>\n>>    \n>>\n>>>This patch inserts a newline in two places - once in the loop to\n>>>separate the subject part of the commit message from the body part of\n>>>the commit message and another after the loop to counteract the eating\n>>>of whitespace at the end of the message.\n>>>      \n>>>\n>>Thanks.\n>>\n>> * Please sign your patch.\n>>\n>> * This breaks a handful t4013 tests, but all in a good way (in\n>>   other words, the expected output files were wrong).\n>>\n>>I'll fix up the t/t4013/diff.* files myself.\n>>    \n>>\n>\n>Actually, I take that back.  This breaks normal commit log\n>messages by adding extra blank lines.  The extra LF is needed\n>when the commit log does not have any message (just title).\n>  \n>\n\nOk, I'll resend with that fixed.\n\n>I'll be tweaking a few tests in t4013 to catch future breakage\n>of this kind.\n>\n\nThanks.\n\n-- \nRob Shearman\n"}]}