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 <Alex.Crezoff@gmail.com> Suggested-by: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alexey Shumkin committed
Jul 5, 2013 at 16:01 UTC
0fe6df3ce8e6373536d1a9016cac9126a1aed0da
1 file changed
+28
-13
t/t6006-rev-list-format.sh
+28
-13
@@ -218,12 +218,7 @@ test_expect_success 'setup complex body' '
218
git config i18n.commitencoding iso8859-1 &&
219
echo change2 >foo && git commit -a -F commit-msg &&
220
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)
222
'
223
224
test_format complex-encoding %e <<EOF
@@ -239,21 +234,41 @@ test_format complex-subject %s <<EOF
234
commit $head3
235
Test printing of complex bodies
236
commit $head2
242
-$changed
237
+$changed_iso88591
238
commit $head1
244
-$added
239
+$added_iso88591
240
EOF
241
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
256
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
264
commit $head2
265
+$changed
266
commit $head1
267
+$added
268
EOF
269
270
+test_format complex-body-commitencoding-unset %b <expected.utf-8
271
+
272
test_expect_success '%x00 shows NUL' '
273
echo >expect commit $head3 &&
274
echo >>expect fooQbar &&