Skip to content

Commit 0fe6df3

Browse files
ashumkingitster
authored andcommitted
t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.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 <[email protected]> Suggested-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 17cc2ef commit 0fe6df3

File tree

1 file changed

+28
-13
lines changed

1 file changed

+28
-13
lines changed

t/t6006-rev-list-format.sh

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,7 @@ test_expect_success 'setup complex body' '
218218
git config i18n.commitencoding iso8859-1 &&
219219
echo change2 >foo && git commit -a -F commit-msg &&
220220
head3=$(git rev-parse --verify HEAD) &&
221-
head3_short=$(git rev-parse --short $head3) &&
222-
# unset commit encoding config
223-
# otherwise %e does not print encoding value
224-
# and following test fails
225-
git config --unset i18n.commitEncoding
226-
221+
head3_short=$(git rev-parse --short $head3)
227222
'
228223

229224
test_format complex-encoding %e <<EOF
@@ -239,21 +234,41 @@ test_format complex-subject %s <<EOF
239234
commit $head3
240235
Test printing of complex bodies
241236
commit $head2
242-
$changed
237+
$changed_iso88591
243238
commit $head1
244-
$added
239+
$added_iso88591
245240
EOF
246241

247-
test_format complex-body %b <<EOF
248-
commit $head3
249-
This commit message is much longer than the others,
250-
and it will be encoded in iso8859-1. We should therefore
251-
include an iso8859 character: ¡bueno!
242+
test_expect_success 'prepare expected messages (for test %b)' '
243+
cat <<-EOF >expected.utf-8 &&
244+
commit $head3
245+
This commit message is much longer than the others,
246+
and it will be encoded in iso8859-1. We should therefore
247+
include an iso8859 character: ¡bueno!
248+
249+
commit $head2
250+
commit $head1
251+
EOF
252+
iconv -f utf-8 -t iso8859-1 expected.utf-8 >expected.iso8859-1
253+
'
254+
255+
test_format complex-body %b <expected.iso8859-1
252256

257+
# Git uses i18n.commitEncoding if no i18n.logOutputEncoding set
258+
# so unset i18n.commitEncoding to test encoding conversion
259+
git config --unset i18n.commitEncoding
260+
261+
test_format complex-subject-commitencoding-unset %s <<EOF
262+
commit $head3
263+
Test printing of complex bodies
253264
commit $head2
265+
$changed
254266
commit $head1
267+
$added
255268
EOF
256269

270+
test_format complex-body-commitencoding-unset %b <expected.utf-8
271+
257272
test_expect_success '%x00 shows NUL' '
258273
echo >expect commit $head3 &&
259274
echo >>expect fooQbar &&

0 commit comments

Comments
 (0)