Merge branch 'mt/patch-id-stable' (early part)
[gitweb.git] / t / t6006-rev-list-format.sh
index b32405a760fe58990e16e977b41325e5b8de04fd..9d9d9de08e1926525c24fc01c1217a96964fa1ee 100755 (executable)
@@ -190,12 +190,9 @@ test_expect_success '%C(auto) respects --no-color' '
 '
 
 test_expect_success TTY '%C(auto) respects --color=auto (stdout is tty)' '
-       (
-               TERM=vt100 && export TERM &&
-               test_terminal \
-                       git log --format=$AUTO_COLOR -1 --color=auto >actual &&
-               has_color actual
-       )
+       test_terminal env TERM=vt100 \
+               git log --format=$AUTO_COLOR -1 --color=auto >actual &&
+       has_color actual
 '
 
 test_expect_success '%C(auto) respects --color=auto (stdout not tty)' '
@@ -218,12 +215,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
@@ -239,21 +231,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 &&