{"thread":{"id":"23109","subject":"[PATCH/RFC] rev-list: fix --pretty=oneline with empty message","startedAt":"2010-03-20T18:20:01Z","lastAt":"2010-03-21T02:54:38Z","messageCount":2,"participants":["Erik Faye-Lund","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137355","messageId":"1269109201-5768-1-git-send-email-kusmabite@gmail.com","threadId":"23109","inReplyTo":null,"subject":"[PATCH/RFC] rev-list: fix --pretty=oneline with empty message","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-20T18:20:01Z","receivedAt":"2010-03-20T18:20:01Z","isPatch":true,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"55246aa (Dont use \"<unknown>\" for placeholders and suppress printing\nof empty user formats) introduced a check to prevent empty\nuser-formats from being printed. This test didn't take empty commit\nmessages into account, and prevented the line-termination from being\noutput. This lead to multiple commits on a single line.\n\nCorrect it by guarding with a check for user-format.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n\nThis is a fix for the issue I posted about with rebase -i:\nhttp://permalink.gmane.org/gmane.comp.version-control.git/141782\n\n builtin/rev-list.c |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 5679170..133056b 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -135,7 +135,8 @@ static void show_commit(struct commit *commit, void *data)\n \t\t\t\t\tputchar('\\n');\n \t\t\t}\n \t\t} else {\n-\t\t\tif (buf.len)\n+\t\t\tif (revs->commit_format != CMIT_FMT_USERFORMAT ||\n+\t\t\t    buf.len)\n \t\t\t\tprintf(\"%s%c\", buf.buf, info->hdr_termination);\n \t\t}\n \t\tstrbuf_release(&buf);\n-- \n1.7.0.2.456.g64f24\n"},{"id":"137405","messageId":"7vk4t64c5t.fsf@alter.siamese.dyndns.org","threadId":"23109","inReplyTo":"1269109201-5768-1-git-send-email-kusmabite@gmail.com","subject":"Re: [PATCH/RFC] rev-list: fix --pretty=oneline with empty message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-21T02:54:38Z","receivedAt":"2010-03-21T02:54:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Erik Faye-Lund <kusmabite@googlemail.com> writes:\n\n> This is a fix for the issue I posted about with rebase -i:\n> http://permalink.gmane.org/gmane.comp.version-control.git/141782\n\nThanks.\n\n> diff --git a/builtin/rev-list.c b/builtin/rev-list.c\n> index 5679170..133056b 100644\n> --- a/builtin/rev-list.c\n> +++ b/builtin/rev-list.c\n> @@ -135,7 +135,8 @@ static void show_commit(struct commit *commit, void *data)\n>  \t\t\t\t\tputchar('\\n');\n>  \t\t\t}\n>  \t\t} else {\n> -\t\t\tif (buf.len)\n> +\t\t\tif (revs->commit_format != CMIT_FMT_USERFORMAT ||\n> +\t\t\t    buf.len)\n>  \t\t\t\tprintf(\"%s%c\", buf.buf, info->hdr_termination);\n>  \t\t}\n\nWhen the format is not user-specified one (e.g. \"-v\"), then a commit with\nno message will only show the regular header, without any body.\n\nI wonder if we need something similar in the \"graph\" case, most of which\nis outside the context before this hunk.  With your patch, this still\nseems to misbehave:\n\n    $ git rev-list --graph --oneline --abbrev=4 HEAD\n    * 8cb0 * efea 4th commit\n    * 341e 3rd commit\n    * 2321 2nd commit\n    * 3814 1st commit\n\nAlthough anything other than --oneline seems to do just fine.\n\nPerhaps this one on top, with an appropriate test, and we can lose the RFC\nfrom the title?\n\n builtin-rev-list.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-rev-list.c b/builtin-rev-list.c\nindex 133056b..1db4b4c 100644\n--- a/builtin-rev-list.c\n+++ b/builtin-rev-list.c\n@@ -133,6 +133,8 @@ static void show_commit(struct commit *commit, void *data)\n \t\t\t\t */\n \t\t\t\tif (graph_show_remainder(revs->graph))\n \t\t\t\t\tputchar('\\n');\n+\t\t\t\tif (revs->commit_format == CMIT_FMT_ONELINE)\n+\t\t\t\t\tputchar('\\n');\n \t\t\t}\n \t\t} else {\n \t\t\tif (revs->commit_format != CMIT_FMT_USERFORMAT ||\n"}]}