{"thread":{"id":"23120","subject":"[PATCH] rev-list: fix --pretty=oneline with empty message","startedAt":"2010-03-21T14:40:16Z","lastAt":"2010-03-21T14:40:16Z","messageCount":1,"participants":["Erik Faye-Lund"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137448","messageId":"1269182416-4156-1-git-send-email-kusmabite@gmail.com","threadId":"23120","inReplyTo":null,"subject":"[PATCH] rev-list: fix --pretty=oneline with empty message","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@googlemail.com","sentAt":"2010-03-21T14:40:16Z","receivedAt":"2010-03-21T14:40:16Z","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 the check with a check for user-format. A\nsimilar correction for the --graph code-path has been included.\n\nSigned-off-by: Erik Faye-Lund <kusmabite@gmail.com>\n---\n\nAdjusted as suggested by Junio.\n\n builtin/rev-list.c         |    5 ++++-\n t/t6006-rev-list-format.sh |    9 +++++++++\n 2 files changed, 13 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/rev-list.c b/builtin/rev-list.c\nindex 5679170..1db4b4c 100644\n--- a/builtin/rev-list.c\n+++ b/builtin/rev-list.c\n@@ -133,9 +133,12 @@ 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 (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);\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex b0047d3..d24ca5c 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -209,4 +209,13 @@ test_expect_success '%gd shortens ref name' '\n \ttest_cmp expect.gd-short actual.gd-short\n '\n \n+test_expect_success 'oneline with empty message' '\n+\tgit commit -m \"dummy\" --allow-empty &&\n+\tgit commit -m \"dummy\" --allow-empty &&\n+\tgit filter-branch --msg-filter \"sed -e s/dummy//\" HEAD^^.. &&\n+\tgit rev-list --oneline HEAD > /tmp/test.txt &&\n+\ttest $(git rev-list --oneline HEAD | wc -l) -eq 5 &&\n+\ttest $(git rev-list --oneline --graph HEAD | wc -l) -eq 5\n+'\n+\n test_done\n-- \n1.7.0.2.456.g1a43b.dirty\n"}]}