1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-01 17:06:13 +02:00

Merge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint

"git show -s" (i.e. show log message only) used to incorrectly emit
an extra blank line after a merge commit.

* mk/show-s-no-extra-blank-line-for-merges:
  git-show: fix 'git show -s' to not add extra terminator after merge commit
This commit is contained in:
Junio C Hamano 2014-06-25 11:49:39 -07:00
commit 85785df6d6
4 changed files with 15 additions and 11 deletions

View File

@ -1339,7 +1339,8 @@ void diff_tree_combined(const unsigned char *sha1,
if (show_log_first && i == 0) { if (show_log_first && i == 0) {
show_log(rev); show_log(rev);
if (rev->verbose_header && opt->output_format) if (rev->verbose_header && opt->output_format &&
opt->output_format != DIFF_FORMAT_NO_OUTPUT)
printf("%s%c", diff_line_prefix(opt), printf("%s%c", diff_line_prefix(opt),
opt->line_termination); opt->line_termination);
} }

View File

@ -121,7 +121,7 @@ test_expect_success 'merge my-side@{u} records the correct name' '
git branch -D new ;# can fail but is ok git branch -D new ;# can fail but is ok
git branch -t new my-side@{u} && git branch -t new my-side@{u} &&
git merge -s ours new@{u} && git merge -s ours new@{u} &&
git show -s --pretty=format:%s >actual && git show -s --pretty=tformat:%s >actual &&
echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect && echo "Merge remote-tracking branch ${sq}origin/side${sq}" >expect &&
test_cmp expect actual test_cmp expect actual
) )

View File

@ -24,7 +24,8 @@ test_expect_success 'set up a bit of history' '
git tag -m "annotated tag" annotated && git tag -m "annotated tag" annotated &&
git checkout -b side HEAD^^ && git checkout -b side HEAD^^ &&
test_commit side2 && test_commit side2 &&
test_commit side3 test_commit side3 &&
test_merge merge main3
' '
test_expect_success 'showing two commits' ' test_expect_success 'showing two commits' '
@ -109,8 +110,11 @@ test_expect_success 'showing range' '
' '
test_expect_success '-s suppresses diff' ' test_expect_success '-s suppresses diff' '
echo main3 >expect && cat >expect <<-\EOF &&
git show -s --format=%s main3 >actual && merge
main3
EOF
git show -s --format=%s merge main3 >actual &&
test_cmp expect actual test_cmp expect actual
' '

View File

@ -57,11 +57,10 @@ create_merge_msgs () {
git log --no-merges ^HEAD c2 c3 git log --no-merges ^HEAD c2 c3
} >squash.1-5-9 && } >squash.1-5-9 &&
: >msg.nologff && : >msg.nologff &&
echo >msg.nolognoff && : >msg.nolognoff &&
{ {
echo "* tag 'c3':" && echo "* tag 'c3':" &&
echo " commit 3" && echo " commit 3"
echo
} >msg.log } >msg.log
} }
@ -71,7 +70,7 @@ verify_merge () {
git diff --exit-code && git diff --exit-code &&
if test -n "$3" if test -n "$3"
then then
git show -s --pretty=format:%s HEAD >msg.act && git show -s --pretty=tformat:%s HEAD >msg.act &&
test_cmp "$3" msg.act test_cmp "$3" msg.act
fi fi
} }
@ -620,10 +619,10 @@ test_expect_success 'merge early part of c2' '
git tag c6 && git tag c6 &&
git branch -f c5-branch c5 && git branch -f c5-branch c5 &&
git merge c5-branch~1 && git merge c5-branch~1 &&
git show -s --pretty=format:%s HEAD >actual.branch && git show -s --pretty=tformat:%s HEAD >actual.branch &&
git reset --keep HEAD^ && git reset --keep HEAD^ &&
git merge c5~1 && git merge c5~1 &&
git show -s --pretty=format:%s HEAD >actual.tag && git show -s --pretty=tformat:%s HEAD >actual.tag &&
test_cmp expected.branch actual.branch && test_cmp expected.branch actual.branch &&
test_cmp expected.tag actual.tag test_cmp expected.tag actual.tag
' '