Skip to content

Commit

Permalink
t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18…
Browse files Browse the repository at this point in the history
…n.commitEncoding is not set

In de6029a (pretty: Add failing tests: --format output should honor
logOutputEncoding, 2013-06-26) 'complex-subject' test was changed.
Revert it back, because that change actually removed tests for "%b"
and "%s" with i18n.commitEncoding set.  Also, add two more tests for
mentioned above "%b" and "%s" to test encoding conversions with no
i18n.commitEncoding set.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Suggested-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Alexey Shumkin authored and Junio C Hamano committed Jul 5, 2013
1 parent 17cc2ef commit 0fe6df3
Showing 1 changed file with 28 additions and 13 deletions.
41 changes: 28 additions & 13 deletions t/t6006-rev-list-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ test_expect_success 'setup complex body' '
git config i18n.commitencoding iso8859-1 &&
echo change2 >foo && git commit -a -F commit-msg &&
head3=$(git rev-parse --verify HEAD) &&
head3_short=$(git rev-parse --short $head3) &&
# unset commit encoding config
# otherwise %e does not print encoding value
# and following test fails
git config --unset i18n.commitEncoding
head3_short=$(git rev-parse --short $head3)
'

test_format complex-encoding %e <<EOF
Expand All @@ -239,21 +234,41 @@ test_format complex-subject %s <<EOF
commit $head3
Test printing of complex bodies
commit $head2
$changed
$changed_iso88591
commit $head1
$added
$added_iso88591
EOF

test_format complex-body %b <<EOF
commit $head3
This commit message is much longer than the others,
and it will be encoded in iso8859-1. We should therefore
include an iso8859 character: ¡bueno!
test_expect_success 'prepare expected messages (for test %b)' '
cat <<-EOF >expected.utf-8 &&
commit $head3
This commit message is much longer than the others,
and it will be encoded in iso8859-1. We should therefore
include an iso8859 character: ¡bueno!
commit $head2
commit $head1
EOF
iconv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1
'

test_format complex-body %b <expected.iso8859-1

# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set
# so unset i18n.commitEncoding to test encoding conversion
git config --unset i18n.commitEncoding

test_format complex-subject-commitencoding-unset %s <<EOF
commit $head3
Test printing of complex bodies
commit $head2
$changed
commit $head1
$added
EOF

test_format complex-body-commitencoding-unset %b <expected.utf-8

test_expect_success '%x00 shows NUL' '
echo >expect commit $head3 &&
echo >>expect fooQbar &&
Expand Down

0 comments on commit 0fe6df3

Please sign in to comment.