{"thread":{"id":"36641","subject":"[PATCH 1/2] git-show: fix 'git show -s' to not add extra terminator after merge commit","startedAt":"2014-05-12T22:35:18Z","lastAt":"2014-05-12T22:43:43Z","messageCount":3,"participants":["Max Kirillov"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"241323","messageId":"20140512223517.GA32205@wheezy.local","threadId":"36641","inReplyTo":null,"subject":"[PATCH 0/2] fix 'git show -s' to not add extra terminator after merge commit","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2014-05-12T22:35:18Z","receivedAt":"2014-05-12T22:35:18Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"* fix the CC issues\n* add fixes for existing tests\n\nMax Kirillov (2):\n  git-show: fix 'git show -s' to not add extra terminator after merge commit\n  t: git-show: adapt tests to fixed 'git show'\n\n combine-diff.c                |  3 ++-\n t/t1507-rev-parse-upstream.sh |  2 +-\n t/t7007-show.sh               |  8 ++++++--\n t/t7600-merge.sh              | 11 +++++------\n 4 files changed, 14 insertions(+), 10 deletions(-)\n\n-- \n1.8.5.2.421.g4cdf8d0\n"},{"id":"241322","messageId":"20140512224234.GA32316@wheezy.local","threadId":"36641","inReplyTo":"20140512223517.GA32205@wheezy.local","subject":"[PATCH 1/2] git-show: fix 'git show -s' to not add extra terminator after merge commit","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2014-05-12T22:42:34Z","receivedAt":"2014-05-12T22:42:34Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"When git show -s is called for merge commit it prints extra newline\nafter any merge commit and the next one. This looks especially ugly for\n--oneline and other single-line formats. Looks very much like a bug.\n\nThe code in question exists since commit 3969cf7db1. Probably the\ncorrect condition should be in fact\n\"opt->output_format & DIFF_FORMAT_DIFFSTAT\".\n\nTest t7007-show.sh is also modified to cover this case.\n---\n combine-diff.c  | 3 ++-\n t/t7007-show.sh | 8 ++++++--\n 2 files changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 3b92c448..ff6ceaf 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -1331,7 +1331,8 @@ void diff_tree_combined(const unsigned char *sha1,\n \t\tif (show_log_first && i == 0) {\n \t\t\tshow_log(rev);\n \n-\t\t\tif (rev->verbose_header && opt->output_format)\n+\t\t\tif (rev->verbose_header && opt->output_format &&\n+\t\t\t    opt->output_format != DIFF_FORMAT_NO_OUTPUT)\n \t\t\t\tprintf(\"%s%c\", diff_line_prefix(opt),\n \t\t\t\t       opt->line_termination);\n \t\t}\ndiff --git a/t/t7007-show.sh b/t/t7007-show.sh\nindex e41fa00..de22812 100755\n--- a/t/t7007-show.sh\n+++ b/t/t7007-show.sh\n@@ -25,6 +25,7 @@ test_expect_success 'set up a bit of history' '\n \tgit checkout -b side HEAD^^ &&\n \ttest_commit side2 &&\n \ttest_commit side3\n+\ttest_merge merge main3\n '\n \n test_expect_success 'showing two commits' '\n@@ -109,8 +110,11 @@ test_expect_success 'showing range' '\n '\n \n test_expect_success '-s suppresses diff' '\n-\techo main3 >expect &&\n-\tgit show -s --format=%s main3 >actual &&\n+\tcat >expect <<-\\EOF &&\n+\tmerge\n+\tmain3\n+\tEOF\n+\tgit show -s --format=%s merge main3 >actual &&\n \ttest_cmp expect actual\n '\n \n-- \n1.8.5.2.421.g4cdf8d0\n"},{"id":"241324","messageId":"20140512224343.GB32316@wheezy.local","threadId":"36641","inReplyTo":"20140512223517.GA32205@wheezy.local","subject":"[PATCH 2/2] t: git-show: adapt tests to fixed 'git show'","fromName":"Max Kirillov","fromEmail":"max@max630.net","sentAt":"2014-05-12T22:43:43Z","receivedAt":"2014-05-12T22:43:43Z","isPatch":true,"sender":{"key":"max@max630.net","avatar":"https://avatars.githubusercontent.com/u/381560?v=4"},"body":"'git show' used to print extra newline after merge commit, and it was\nrecorded so into the test reference data. Now when the behavior is\nfixed, the tests should be updated.\n\nNote that '--format=%s' works like '--pretty=tformat:%s'. This\nis why non-merging cases pass, like t3505-cherry-pick-empty.sh\nfor example, though they look very similarly.\n---\n t/t1507-rev-parse-upstream.sh |  2 +-\n t/t7600-merge.sh              | 11 +++++------\n 2 files changed, 6 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t1507-rev-parse-upstream.sh b/t/t1507-rev-parse-upstream.sh\nindex 2a19e79..672280b 100755\n--- a/t/t1507-rev-parse-upstream.sh\n+++ b/t/t1507-rev-parse-upstream.sh\n@@ -100,7 +100,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '\n \tgit branch -D new ;# can fail but is ok\n \tgit branch -t new my-side@{u} &&\n \tgit merge -s ours new@{u} &&\n-\tgit show -s --pretty=format:%s >actual &&\n+\tgit show -s --pretty=tformat:%s >actual &&\n \techo \"Merge remote-tracking branch ${sq}origin/side${sq}\" >expect &&\n \ttest_cmp expect actual\n )\ndiff --git a/t/t7600-merge.sh b/t/t7600-merge.sh\nindex 10aa028..b164621 100755\n--- a/t/t7600-merge.sh\n+++ b/t/t7600-merge.sh\n@@ -57,11 +57,10 @@ create_merge_msgs () {\n \t\tgit log --no-merges ^HEAD c2 c3\n \t} >squash.1-5-9 &&\n \t: >msg.nologff &&\n-\techo >msg.nolognoff &&\n+\t: >msg.nolognoff &&\n \t{\n \t\techo \"* tag 'c3':\" &&\n-\t\techo \"  commit 3\" &&\n-\t\techo\n+\t\techo \"  commit 3\"\n \t} >msg.log\n }\n \n@@ -71,7 +70,7 @@ verify_merge () {\n \tgit diff --exit-code &&\n \tif test -n \"$3\"\n \tthen\n-\t\tgit show -s --pretty=format:%s HEAD >msg.act &&\n+\t\tgit show -s --pretty=tformat:%s HEAD >msg.act &&\n \t\ttest_cmp \"$3\" msg.act\n \tfi\n }\n@@ -620,10 +619,10 @@ test_expect_success 'merge early part of c2' '\n \tgit tag c6 &&\n \tgit branch -f c5-branch c5 &&\n \tgit merge c5-branch~1 &&\n-\tgit show -s --pretty=format:%s HEAD >actual.branch &&\n+\tgit show -s --pretty=tformat:%s HEAD >actual.branch &&\n \tgit reset --keep HEAD^ &&\n \tgit merge c5~1 &&\n-\tgit show -s --pretty=format:%s HEAD >actual.tag &&\n+\tgit show -s --pretty=tformat:%s HEAD >actual.tag &&\n \ttest_cmp expected.branch actual.branch &&\n \ttest_cmp expected.tag actual.tag\n '\n-- \n1.8.5.2.421.g4cdf8d0\n"}]}