summaryrefslogtreecommitdiff
path: root/t/t7007-show.sh
diff options
context:
space:
mode:
authorMax Kirillov <max@max630.net>2014-05-14 22:12:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-05-15 16:32:08 (GMT)
commitad2f7255b3e93dacd0982a946d30f6595dd8a805 (patch)
tree95d3bee63800fbe022425b4ad46d9375f7fb6691 /t/t7007-show.sh
parent7bbc4e8fdb33e0a8e42e77cc05460d4c4f615f4d (diff)
downloadgit-ad2f7255b3e93dacd0982a946d30f6595dd8a805.zip
git-ad2f7255b3e93dacd0982a946d30f6595dd8a805.tar.gz
git-ad2f7255b3e93dacd0982a946d30f6595dd8a805.tar.bz2
git-show: fix 'git show -s' to not add extra terminator after merge commit
When git show -s is called for merge commit it prints extra newline after any merge commit. This differs from output for commits with one parent. Fix it by more thorough checking that diff output is disabled. The code in question exists since commit 3969cf7db1. The additional newline is really needed for cases when patch is requested, test t4013-diff-various.sh contains cases which can demonstrate behavior when the condition is restricted further. Tests: Added merge commit to 'set up a bit of history' case in t7007-show.sh to cover the fix. Existing tests are updated to demonstrate the new behaviour. Earlier, the tests that used "git show -s --pretty=format:%s", even though "--pretty=format:%s" calls for item separator semantics and does not ask for the terminating newline after the last item, expected the output to end with such a newline. They were relying on the buggy behaviour. Use of "--format=%s", which is equivalent to "--pretty=tformat:%s" that asks for a terminating newline after each item, is a more realistic way to use the command. In the test 'merge log messages' the expected data is changed, because it was explicitly listing the extra newline. Also the msg.nologff and msg.nolognoff expected files are replaced by one msg.nolog, because they were diffing because of the bug, and now there should be no difference. Signed-off-by: Max Kirillov <max@max630.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7007-show.sh')
-rwxr-xr-xt/t7007-show.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/t/t7007-show.sh b/t/t7007-show.sh
index e41fa00..1b824fe 100755
--- a/t/t7007-show.sh
+++ b/t/t7007-show.sh
@@ -24,7 +24,8 @@ test_expect_success 'set up a bit of history' '
git tag -m "annotated tag" annotated &&
git checkout -b side HEAD^^ &&
test_commit side2 &&
- test_commit side3
+ test_commit side3 &&
+ test_merge merge main3
'
test_expect_success 'showing two commits' '
@@ -109,8 +110,11 @@ test_expect_success 'showing range' '
'
test_expect_success '-s suppresses diff' '
- echo main3 >expect &&
- git show -s --format=%s main3 >actual &&
+ cat >expect <<-\EOF &&
+ merge
+ main3
+ EOF
+ git show -s --format=%s merge main3 >actual &&
test_cmp expect actual
'