{"thread":{"id":"6203","subject":"[PATCH] Skip excessive blank lines before commit body","startedAt":"2007-01-03T13:34:13Z","lastAt":"2007-01-04T15:50:54Z","messageCount":3,"participants":["Lars Hjemli","Junio C Hamano","Andreas Ericsson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"30748","messageId":"11678312532251-git-send-email-hjemli@gmail.com","threadId":"6203","inReplyTo":null,"subject":"[PATCH] Skip excessive blank lines before commit body","fromName":"Lars Hjemli","fromEmail":"hjemli@gmail.com","sentAt":"2007-01-03T13:34:13Z","receivedAt":"2007-01-03T13:34:13Z","isPatch":true,"sender":{"key":"hjemli@gmail.com","avatar":null},"body":"This modifies pretty_print_commit() to make the output of git-rev-list and\nfriends a bit more predictable.\n\nA commit body starting with blank lines might be unheard-of, but still possible\nto create using git-commit-tree (so is bound to appear somewhere, sometime).\n\nSigned-off-by: Lars Hjemli <hjemli@gmail.com>\n---\n commit.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex 544e426..2a58175 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -703,7 +703,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,\n \t\t\t\t  const char *after_subject,\n \t\t\t\t  int relative_date)\n {\n-\tint hdr = 1, body = 0;\n+\tint hdr = 1, body = 0, seen_title = 0;\n \tunsigned long offset = 0;\n \tint indent = 4;\n \tint parents_shown = 0;\n@@ -809,6 +809,8 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,\n \t\t\tbody = 1;\n \n \t\tif (is_empty_line(line, &linelen)) {\n+\t\t\tif (!seen_title)\n+\t\t\t\tcontinue;\n \t\t\tif (!body)\n \t\t\t\tcontinue;\n \t\t\tif (subject)\n@@ -817,6 +819,7 @@ unsigned long pretty_print_commit(enum cmit_fmt fmt,\n \t\t\t\tbreak;\n \t\t}\n \n+\t\tseen_title = 1;\n \t\tif (subject) {\n \t\t\tint slen = strlen(subject);\n \t\t\tmemcpy(buf + offset, subject, slen);\n-- \n1.5.0.rc0.ge900\n"},{"id":"30760","messageId":"7v64booxfc.fsf@assigned-by-dhcp.cox.net","threadId":"6203","inReplyTo":"11678312532251-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] Skip excessive blank lines before commit body","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-03T17:03:03Z","receivedAt":"2007-01-03T17:03:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Hjemli <hjemli@gmail.com> writes:\n\n> This modifies pretty_print_commit() to make the output of\n> git-rev-list and friends a bit more predictable.\n>\n> A commit body starting with blank lines might be unheard-of,\n> but still possible to create using git-commit-tree (so is\n> bound to appear somewhere, sometime).\n\nThis is unfortunately (!!) a good change.  By design,\ncommit-tree should take whatever binary garbage the user throws\nat it as-is (there is no requirement for it to be even text),\nand the \"punchline + LF + body + LF + signoffs\" is strictly by\nconvention.  We already reformat using indentations and friends,\nso your change is a very sane thing to do.\n\nWe might want to tighten the formatting convention enforced at\nthe Porcelain level -- we can start the process by shipping a\nsample commit message hook that checks a well formatted commit\nlog message, perhaps?\n"},{"id":"30818","messageId":"459D225E.4010208@op5.se","threadId":"6203","inReplyTo":"11678312532251-git-send-email-hjemli@gmail.com","subject":"Re: [PATCH] Skip excessive blank lines before commit body","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-01-04T15:50:54Z","receivedAt":"2007-01-04T15:50:54Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Lars Hjemli wrote:\n> This modifies pretty_print_commit() to make the output of git-rev-list and\n> friends a bit more predictable.\n> \n> A commit body starting with blank lines might be unheard-of, but still possible\n> to create using git-commit-tree (so is bound to appear somewhere, sometime).\n> \n\nLovely. I was just looking in to doing the exact same thing myself.\n\nFor reference, there is a tool somewhere that creates CVS commit \nmessages with an empty title-line. When imported to git, those empty \nlines remain and fuzz up gitk and qgit viewing ad nauseum. I'm guessing \n(and hoping) this patch would take care of it.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}