3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='commit and log output encodings'
10 say
"iconv not supported, skipping tests."
15 git show
-s $1 |
sed -e '1,/^$/d' -e 's/^ //' -e '$d' >current
&&
19 test_expect_success setup
'
22 T=$(git write-tree) &&
23 C=$(git commit-tree $T <../t3900/1-UTF-8.txt) &&
24 git update-ref HEAD $C &&
28 test_expect_success
'no encoding header for base case' '
29 E=$(git cat-file commit C0 | sed -ne "s/^encoding //p") &&
33 for H
in ISO-8859-1 EUCJP ISO-2022-JP
35 test_expect_success
"$H setup" '
36 git config i18n.commitencoding $H &&
37 git-checkout -b $H C0 &&
39 git-commit -a -F ../t3900/$H.txt
43 for H
in ISO-8859-1 EUCJP ISO-2022-JP
45 test_expect_success
"check encoding header for $H" '
46 E=$(git cat-file commit '$H' | sed -ne "s/^encoding //p") &&
51 test_expect_success
'config to remove customization' '
52 git config --unset-all i18n.commitencoding &&
53 if Z=$(git config --get-all i18n.commitencoding)
55 echo Oops, should have failed.
60 git config i18n.commitencoding utf-8
63 test_expect_success
'ISO-8859-1 should be shown in UTF-8 now' '
64 compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
67 for H
in EUCJP ISO-2022-JP
69 test_expect_success
"$H should be shown in UTF-8 now" '
70 compare_with '$H' ../t3900/2-UTF-8.txt
74 test_expect_success
'config to add customization' '
75 git config --unset-all i18n.commitencoding &&
76 if Z=$(git config --get-all i18n.commitencoding)
78 echo Oops, should have failed.
85 for H
in ISO-8859-1 EUCJP ISO-2022-JP
87 test_expect_success
"$H should be shown in itself now" '
88 git config i18n.commitencoding '$H' &&
89 compare_with '$H' ../t3900/'$H'.txt
93 test_expect_success
'config to tweak customization' '
94 git config i18n.logoutputencoding utf-8
97 test_expect_success
'ISO-8859-1 should be shown in UTF-8 now' '
98 compare_with ISO-8859-1 ../t3900/1-UTF-8.txt
101 for H
in EUCJP ISO-2022-JP
103 test_expect_success
"$H should be shown in UTF-8 now" '
104 compare_with '$H' ../t3900/2-UTF-8.txt
108 for J
in EUCJP ISO-2022-JP
110 git config i18n.logoutputencoding
$J
111 for H
in EUCJP ISO-2022-JP
113 test_expect_success
"$H should be shown in $J now" '
114 compare_with '$H' ../t3900/'$J'.txt
119 for H
in ISO-8859-1 EUCJP ISO-2022-JP
121 test_expect_success
"No conversion with $H" '
122 compare_with "--encoding=none '$H'" ../t3900/'$H'.txt