t/test-lib: wire up NO_ICONV prerequisite

The iconv library is used by Git to reencode files, commit messages and other things. As such it is a rather integral part, but given that many platforms nowadays use UTF-8 everywhere you can live without support for reencoding in many situations. It is thus optional to build Git with iconv, and some of our platforms wired up in "config.mak.uname" disable it. But while we support building without it, running our test suite with "NO_ICONV=Yes" causes many test failures. Wire up a new test prerequisite ICONV that gets populated via our GIT-BUILD-OPTIONS. Annotate failing tests accordingly. Note that this commit does not do a deep dive into every single test to assess whether the failure is expected or not. Most of the tests do smell like the expected kind of failure though. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>

Patrick Steinhardt committed Oct 16, 2024 at 10:12 UTC df383b584267d3b7b57fb513bef4a2ff8eb8fe30
22 files changed +229 -106
Makefile
+1
@@ -3171,6 +3171,7 @@ GIT-BUILD-OPTIONS: FORCE
3171 @echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@+
3172 @echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@+
3173 @echo NO_CURL=\''$(subst ','\'',$(subst ','\'',$(NO_CURL)))'\' >>$@+
3174 + @echo NO_ICONV=\''$(subst ','\'',$(subst ','\'',$(NO_ICONV)))'\' >>$@+
3175 @echo NO_EXPAT=\''$(subst ','\'',$(subst ','\'',$(NO_EXPAT)))'\' >>$@+
3176 @echo USE_LIBPCRE2=\''$(subst ','\'',$(subst ','\'',$(USE_LIBPCRE2)))'\' >>$@+
3177 @echo NO_PERL=\''$(subst ','\'',$(subst ','\'',$(NO_PERL)))'\' >>$@+
contrib/buildsystems/CMakeLists.txt
+6
@@ -1109,6 +1109,7 @@ set(DIFF diff)
1109 set(PYTHON_PATH /usr/bin/python)
1110 set(TAR tar)
1111 set(NO_CURL )
1112 +set(NO_ICONV )
1113 set(NO_EXPAT )
1114 set(USE_LIBPCRE2 )
1115 set(NO_PERL )
@@ -1122,6 +1123,10 @@ if(NOT CURL_FOUND)
1123 set(NO_CURL 1)
1124 endif()
1125
1126 +if(NOT Iconv_FOUND)
1127 + SET(NO_ICONV 1)
1128 +endif()
1129 +
1130 if(NOT EXPAT_FOUND)
1131 set(NO_EXPAT 1)
1132 endif()
@@ -1145,6 +1150,7 @@ file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "DIFF='${DIFF}'\n")
1150 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "PYTHON_PATH='${PYTHON_PATH}'\n")
1151 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "TAR='${TAR}'\n")
1152 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_CURL='${NO_CURL}'\n")
1153 +file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_ICONV='${NO_ICONV}'\n")
1154 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_EXPAT='${NO_EXPAT}'\n")
1155 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PERL='${NO_PERL}'\n")
1156 file(APPEND ${CMAKE_BINARY_DIR}/GIT-BUILD-OPTIONS "NO_PTHREADS='${NO_PTHREADS}'\n")
t/t0028-working-tree-encoding.sh
+6
@@ -12,6 +12,12 @@ TEST_CREATE_REPO_NO_TEMPLATE=1
12
13 GIT_TRACE_WORKING_TREE_ENCODING=1 && export GIT_TRACE_WORKING_TREE_ENCODING
14
15 +if ! test_have_prereq ICONV
16 +then
17 + skip_all='skipping working tree encoding tests; iconv not available'
18 + test_done
19 +fi
20 +
21 test_expect_success 'setup test files' '
22 git config core.eol lf &&
23
t/t2082-parallel-checkout-attributes.sh
+1 -1
@@ -34,7 +34,7 @@ test_expect_success 'parallel-checkout with ident' '
34 )
35 '
36
37 -test_expect_success 'parallel-checkout with re-encoding' '
37 +test_expect_success ICONV 'parallel-checkout with re-encoding' '
38 set_checkout_config 2 0 &&
39 git init encoding &&
40 (
t/t3434-rebase-i18n.sh
+6
@@ -20,6 +20,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
20 TEST_PASSES_SANITIZE_LEAK=true
21 . ./test-lib.sh
22
23 +if ! test_have_prereq ICONV
24 +then
25 + skip_all='skipping rebase i18n tests; iconv not available'
26 + test_done
27 +fi
28 +
29 compare_msg () {
30 iconv -f "$2" -t "$3" "$TEST_DIRECTORY/t3434/$1" >expect &&
31 git cat-file commit HEAD >raw &&
t/t3900-i18n-commit.sh
+6
@@ -8,6 +8,12 @@ test_description='commit and log output encodings'
8 TEST_PASSES_SANITIZE_LEAK=true
9 . ./test-lib.sh
10
11 +if ! test_have_prereq ICONV
12 +then
13 + skip_all='skipping commit i18n tests; iconv not available'
14 + test_done
15 +fi
16 +
17 compare_with () {
18 git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current &&
19 case "$3" in
t/t3901-i18n-patch.sh
+6
@@ -11,6 +11,12 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11 TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
13
14 +if ! test_have_prereq ICONV
15 +then
16 + skip_all='skipping patch i18n tests; iconv not available'
17 + test_done
18 +fi
19 +
20 check_encoding () {
21 # Make sure characters are not corrupted
22 cnt="$1" header="$2" i=1 j=0
t/t4041-diff-submodule-option.sh
+11 -5
@@ -15,12 +15,18 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
15 TEST_PASSES_SANITIZE_LEAK=true
16 . ./test-lib.sh
17
18 -# Tested non-UTF-8 encoding
19 -test_encoding="ISO8859-1"
18 +# Test non-UTF-8 encoding in case iconv is available.
19 +if test_have_prereq ICONV
20 +then
21 + test_encoding="ISO8859-1"
22 + # String "added" in German (translated with Google Translate), encoded in UTF-8,
23 + # used in sample commit log messages in add_file() function below.
24 + added=$(printf "hinzugef\303\274gt")
25 +else
26 + test_encoding="UTF-8"
27 + added="added"
28 +fi
29
21 -# String "added" in German (translated with Google Translate), encoded in UTF-8,
22 -# used in sample commit log messages in add_file() function below.
23 -added=$(printf "hinzugef\303\274gt")
30 add_file () {
31 (
32 cd "$1" &&
t/t4059-diff-submodule-not-initialized.sh
+11 -5
@@ -12,12 +12,18 @@ initialized previously but the checkout has since been removed.
12 TEST_PASSES_SANITIZE_LEAK=true
13 . ./test-lib.sh
14
15 -# Tested non-UTF-8 encoding
16 -test_encoding="ISO8859-1"
15
18 -# String "added" in German (translated with Google Translate), encoded in UTF-8,
19 -# used in sample commit log messages in add_file() function below.
20 -added=$(printf "hinzugef\303\274gt")
16 +# Test non-UTF-8 encoding in case iconv is available.
17 +if test_have_prereq ICONV
18 +then
19 + test_encoding="ISO8859-1"
20 + # String "added" in German (translated with Google Translate), encoded in UTF-8,
21 + # used in sample commit log messages in add_file() function below.
22 + added=$(printf "hinzugef\303\274gt")
23 +else
24 + test_encoding="UTF-8"
25 + added="added"
26 +fi
27
28 add_file () {
29 (
t/t4060-diff-submodule-option-diff-format.sh
+11 -6
@@ -13,12 +13,17 @@ This test tries to verify the sanity of --submodule=diff option of git diff.
13 TEST_PASSES_SANITIZE_LEAK=true
14 . ./test-lib.sh
15
16 -# Tested non-UTF-8 encoding
17 -test_encoding="ISO8859-1"
18 -
19 -# String "added" in German (translated with Google Translate), encoded in UTF-8,
20 -# used in sample commit log messages in add_file() function below.
21 -added=$(printf "hinzugef\303\274gt")
16 +# Test non-UTF-8 encoding in case iconv is available.
17 +if test_have_prereq ICONV
18 +then
19 + test_encoding="ISO8859-1"
20 + # String "added" in German (translated with Google Translate), encoded in UTF-8,
21 + # used in sample commit log messages in add_file() function below.
22 + added=$(printf "hinzugef\303\274gt")
23 +else
24 + test_encoding="UTF-8"
25 + added="added"
26 +fi
27
28 add_file () {
29 (
t/t4201-shortlog.sh
+4 -4
@@ -105,7 +105,7 @@ test_expect_success 'output from user-defined format is re-wrapped' '
105 test_cmp expect log.predictable
106 '
107
108 -test_expect_success !MINGW 'shortlog wrapping' '
108 +test_expect_success !MINGW,ICONV 'shortlog wrapping' '
109 cat >expect <<\EOF &&
110 A U Thor (5):
111 Test
@@ -126,13 +126,13 @@ EOF
126 test_cmp expect out
127 '
128
129 -test_expect_success !MINGW 'shortlog from non-git directory' '
129 +test_expect_success !MINGW,ICONV 'shortlog from non-git directory' '
130 git log --no-expand-tabs HEAD >log &&
131 GIT_DIR=non-existing git shortlog -w <log >out &&
132 test_cmp expect out
133 '
134
135 -test_expect_success !MINGW 'shortlog can read --format=raw output' '
135 +test_expect_success !MINGW,ICONV 'shortlog can read --format=raw output' '
136 git log --format=raw HEAD >log &&
137 GIT_DIR=non-existing git shortlog -w <log >out &&
138 test_cmp expect out
@@ -182,7 +182,7 @@ $DSCHO (2):
182
183 EOF
184
185 -test_expect_success !MINGW 'shortlog encoding' '
185 +test_expect_success !MINGW,ICONV 'shortlog encoding' '
186 git reset --hard "$commit" &&
187 git config --unset i18n.commitencoding &&
188 echo 2 > a1 &&
t/t4205-log-pretty-formats.sh
+59 -43
@@ -114,19 +114,19 @@ test_expect_success 'alias loop' '
114 test_must_fail git log --pretty=test-foo
115 '
116
117 -test_expect_success 'NUL separation' '
117 +test_expect_success ICONV 'NUL separation' '
118 printf "add bar\0$(commit_msg)" >expected &&
119 git log -z --pretty="format:%s" >actual &&
120 test_cmp expected actual
121 '
122
123 -test_expect_success 'NUL termination' '
123 +test_expect_success ICONV 'NUL termination' '
124 printf "add bar\0$(commit_msg)\0" >expected &&
125 git log -z --pretty="tformat:%s" >actual &&
126 test_cmp expected actual
127 '
128
129 -test_expect_success 'NUL separation with --stat' '
129 +test_expect_success ICONV 'NUL separation with --stat' '
130 stat0_part=$(git diff --stat HEAD^ HEAD) &&
131 stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
132 printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -181,7 +181,7 @@ test_expect_success 'setup more commits' '
181 head4=$(git rev-parse --verify --short HEAD~3)
182 '
183
184 -test_expect_success 'left alignment formatting' '
184 +test_expect_success ICONV 'left alignment formatting' '
185 git log --pretty="tformat:%<(40)%s" >actual &&
186 qz_to_tab_space <<-EOF >expected &&
187 message two Z
@@ -192,7 +192,7 @@ test_expect_success 'left alignment formatting' '
192 test_cmp expected actual
193 '
194
195 -test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
195 +test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
196 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(40)%s" >actual &&
197 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
198 message two Z
@@ -203,7 +203,7 @@ test_expect_success 'left alignment formatting. i18n.logOutputEncoding' '
203 test_cmp expected actual
204 '
205
206 -test_expect_success 'left alignment formatting at the nth column' '
206 +test_expect_success ICONV 'left alignment formatting at the nth column' '
207 git log --pretty="tformat:%h %<|(40)%s" >actual &&
208 qz_to_tab_space <<-EOF >expected &&
209 $head1 message two Z
@@ -214,7 +214,7 @@ test_expect_success 'left alignment formatting at the nth column' '
214 test_cmp expected actual
215 '
216
217 -test_expect_success 'left alignment formatting at the nth column' '
217 +test_expect_success ICONV 'left alignment formatting at the nth column' '
218 COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
219 qz_to_tab_space <<-EOF >expected &&
220 $head1 message two Z
@@ -225,7 +225,7 @@ test_expect_success 'left alignment formatting at the nth column' '
225 test_cmp expected actual
226 '
227
228 -test_expect_success 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
228 +test_expect_success ICONV 'left alignment formatting at the nth column. i18n.logOutputEncoding' '
229 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %<|(40)%s" >actual &&
230 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
231 $head1 message two Z
@@ -236,7 +236,7 @@ test_expect_success 'left alignment formatting at the nth column. i18n.logOutput
236 test_cmp expected actual
237 '
238
239 -test_expect_success 'left alignment formatting with no padding' '
239 +test_expect_success ICONV 'left alignment formatting with no padding' '
240 git log --pretty="tformat:%<(1)%s" >actual &&
241 cat <<-EOF >expected &&
242 message two
@@ -258,7 +258,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
258 test_cmp expected actual
259 '
260
261 -test_expect_success 'left alignment formatting with trunc' '
261 +test_expect_success ICONV 'left alignment formatting with trunc' '
262 git log --pretty="tformat:%<(10,trunc)%s" >actual &&
263 qz_to_tab_space <<-\EOF >expected &&
264 message ..
@@ -269,7 +269,7 @@ test_expect_success 'left alignment formatting with trunc' '
269 test_cmp expected actual
270 '
271
272 -test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncoding' '
272 +test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputEncoding' '
273 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s" >actual &&
274 qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
275 message ..
@@ -280,7 +280,7 @@ test_expect_success 'left alignment formatting with trunc. i18n.logOutputEncodin
280 test_cmp expected actual
281 '
282
283 -test_expect_success 'left alignment formatting with ltrunc' '
283 +test_expect_success ICONV 'left alignment formatting with ltrunc' '
284 git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
285 qz_to_tab_space <<-EOF >expected &&
286 ..sage two
@@ -291,7 +291,7 @@ test_expect_success 'left alignment formatting with ltrunc' '
291 test_cmp expected actual
292 '
293
294 -test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
294 +test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutputEncoding' '
295 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
296 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
297 ..sage two
@@ -302,7 +302,7 @@ test_expect_success 'left alignment formatting with ltrunc. i18n.logOutputEncodi
302 test_cmp expected actual
303 '
304
305 -test_expect_success 'left alignment formatting with mtrunc' '
305 +test_expect_success ICONV 'left alignment formatting with mtrunc' '
306 git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
307 qz_to_tab_space <<-\EOF >expected &&
308 mess.. two
@@ -313,7 +313,7 @@ test_expect_success 'left alignment formatting with mtrunc' '
313 test_cmp expected actual
314 '
315
316 -test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
316 +test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutputEncoding' '
317 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
318 qz_to_tab_space <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
319 mess.. two
@@ -324,7 +324,7 @@ test_expect_success 'left alignment formatting with mtrunc. i18n.logOutputEncodi
324 test_cmp expected actual
325 '
326
327 -test_expect_success 'right alignment formatting' '
327 +test_expect_success ICONV 'right alignment formatting' '
328 git log --pretty="tformat:%>(40)%s" >actual &&
329 qz_to_tab_space <<-EOF >expected &&
330 Z message two
@@ -335,7 +335,7 @@ test_expect_success 'right alignment formatting' '
335 test_cmp expected actual
336 '
337
338 -test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
338 +test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
339 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(40)%s" >actual &&
340 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
341 Z message two
@@ -346,7 +346,7 @@ test_expect_success 'right alignment formatting. i18n.logOutputEncoding' '
346 test_cmp expected actual
347 '
348
349 -test_expect_success 'right alignment formatting at the nth column' '
349 +test_expect_success ICONV 'right alignment formatting at the nth column' '
350 git log --pretty="tformat:%h %>|(40)%s" >actual &&
351 qz_to_tab_space <<-EOF >expected &&
352 $head1 message two
@@ -357,7 +357,7 @@ test_expect_success 'right alignment formatting at the nth column' '
357 test_cmp expected actual
358 '
359
360 -test_expect_success 'right alignment formatting at the nth column' '
360 +test_expect_success ICONV 'right alignment formatting at the nth column' '
361 COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
362 qz_to_tab_space <<-EOF >expected &&
363 $head1 message two
@@ -368,7 +368,7 @@ test_expect_success 'right alignment formatting at the nth column' '
368 test_cmp expected actual
369 '
370
371 -test_expect_success 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
371 +test_expect_success ICONV 'right alignment formatting at the nth column. i18n.logOutputEncoding' '
372 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %>|(40)%s" >actual &&
373 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
374 $head1 message two
@@ -381,7 +381,7 @@ test_expect_success 'right alignment formatting at the nth column. i18n.logOutpu
381
382 # Note: Space between 'message' and 'two' should be in the same column
383 # as in previous test.
384 -test_expect_success 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
384 +test_expect_success ICONV 'right alignment formatting at the nth column with --graph. i18n.logOutputEncoding' '
385 git -c i18n.logOutputEncoding=$test_encoding log --graph --pretty="tformat:%h %>|(40)%s" >actual &&
386 iconv -f utf-8 -t $test_encoding >expected <<-EOF &&
387 * $head1 message two
@@ -392,7 +392,7 @@ test_expect_success 'right alignment formatting at the nth column with --graph.
392 test_cmp expected actual
393 '
394
395 -test_expect_success 'right alignment formatting with no padding' '
395 +test_expect_success ICONV 'right alignment formatting with no padding' '
396 git log --pretty="tformat:%>(1)%s" >actual &&
397 cat <<-EOF >expected &&
398 message two
@@ -403,7 +403,7 @@ test_expect_success 'right alignment formatting with no padding' '
403 test_cmp expected actual
404 '
405
406 -test_expect_success 'right alignment formatting with no padding and with --graph' '
406 +test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
407 git log --graph --pretty="tformat:%>(1)%s" >actual &&
408 cat <<-EOF >expected &&
409 * message two
@@ -414,7 +414,7 @@ test_expect_success 'right alignment formatting with no padding and with --graph
414 test_cmp expected actual
415 '
416
417 -test_expect_success 'right alignment formatting with no padding. i18n.logOutputEncoding' '
417 +test_expect_success ICONV 'right alignment formatting with no padding. i18n.logOutputEncoding' '
418 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%>(1)%s" >actual &&
419 cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
420 message two
@@ -425,7 +425,7 @@ test_expect_success 'right alignment formatting with no padding. i18n.logOutputE
425 test_cmp expected actual
426 '
427
428 -test_expect_success 'center alignment formatting' '
428 +test_expect_success ICONV 'center alignment formatting' '
429 git log --pretty="tformat:%><(40)%s" >actual &&
430 qz_to_tab_space <<-EOF >expected &&
431 Z message two Z
@@ -436,7 +436,7 @@ test_expect_success 'center alignment formatting' '
436 test_cmp expected actual
437 '
438
439 -test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
439 +test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding' '
440 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(40)%s" >actual &&
441 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
442 Z message two Z
@@ -446,7 +446,7 @@ test_expect_success 'center alignment formatting. i18n.logOutputEncoding' '
446 EOF
447 test_cmp expected actual
448 '
449 -test_expect_success 'center alignment formatting at the nth column' '
449 +test_expect_success ICONV 'center alignment formatting at the nth column' '
450 git log --pretty="tformat:%h %><|(40)%s" >actual &&
451 qz_to_tab_space <<-EOF >expected &&
452 $head1 message two Z
@@ -457,7 +457,7 @@ test_expect_success 'center alignment formatting at the nth column' '
457 test_cmp expected actual
458 '
459
460 -test_expect_success 'center alignment formatting at the nth column' '
460 +test_expect_success ICONV 'center alignment formatting at the nth column' '
461 COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
462 qz_to_tab_space <<-EOF >expected &&
463 $head1 message two Z
@@ -468,7 +468,7 @@ test_expect_success 'center alignment formatting at the nth column' '
468 test_cmp expected actual
469 '
470
471 -test_expect_success 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
471 +test_expect_success ICONV 'center alignment formatting at the nth column. i18n.logOutputEncoding' '
472 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%h %><|(40)%s" >actual &&
473 qz_to_tab_space <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
474 $head1 message two Z
@@ -479,7 +479,7 @@ test_expect_success 'center alignment formatting at the nth column. i18n.logOutp
479 test_cmp expected actual
480 '
481
482 -test_expect_success 'center alignment formatting with no padding' '
482 +test_expect_success ICONV 'center alignment formatting with no padding' '
483 git log --pretty="tformat:%><(1)%s" >actual &&
484 cat <<-EOF >expected &&
485 message two
@@ -493,7 +493,7 @@ test_expect_success 'center alignment formatting with no padding' '
493 # save HEAD's SHA-1 digest (with no abbreviations) to use it below
494 # as far as the next test amends HEAD
495 old_head1=$(git rev-parse --verify HEAD~0)
496 -test_expect_success 'center alignment formatting with no padding. i18n.logOutputEncoding' '
496 +test_expect_success ICONV 'center alignment formatting with no padding. i18n.logOutputEncoding' '
497 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%><(1)%s" >actual &&
498 cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
499 message two
@@ -504,7 +504,7 @@ test_expect_success 'center alignment formatting with no padding. i18n.logOutput
504 test_cmp expected actual
505 '
506
507 -test_expect_success 'left/right alignment formatting with stealing' '
507 +test_expect_success ICONV 'left/right alignment formatting with stealing' '
508 git commit --amend -m short --author "long long long <long@me.com>" &&
509 git log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
510 cat <<-\EOF >expected &&
@@ -515,7 +515,7 @@ test_expect_success 'left/right alignment formatting with stealing' '
515 EOF
516 test_cmp expected actual
517 '
518 -test_expect_success 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
518 +test_expect_success ICONV 'left/right alignment formatting with stealing. i18n.logOutputEncoding' '
519 git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(10,trunc)%s%>>(10,ltrunc)% an" >actual &&
520 cat <<-\EOF | iconv -f utf-8 -t $test_encoding >expected &&
521 short long long long
@@ -564,22 +564,38 @@ test_expect_success 'log decoration properly follows tag chain' '
564 git tag -d tag1 &&
565 git commit --amend -m shorter &&
566 git log --no-walk --tags --pretty="%H %d" --decorate=full >actual &&
567 - cat <<-EOF >expected &&
568 - $head2 (tag: refs/tags/message-one)
569 - $old_head1 (tag: refs/tags/message-two)
570 - $head1 (tag: refs/tags/tag2)
571 - EOF
567 + if test_have_prereq ICONV
568 + then
569 + cat <<-EOF >expected
570 + $head2 (tag: refs/tags/message-one)
571 + $old_head1 (tag: refs/tags/message-two)
572 + $head1 (tag: refs/tags/tag2)
573 + EOF
574 + else
575 + cat <<-EOF >expected
576 + $head2 (tag: refs/tags/message-one)
577 + $old_head1 (tag: refs/tags/tag2, tag: refs/tags/message-two)
578 + EOF
579 + fi &&
580 sort -k3 actual >actual1 &&
581 test_cmp expected actual1
582 '
583
584 test_expect_success 'clean log decoration' '
585 git log --no-walk --tags --pretty="%H %D" --decorate=full >actual &&
578 - cat >expected <<-EOF &&
579 - $head2 tag: refs/tags/message-one
580 - $old_head1 tag: refs/tags/message-two
581 - $head1 tag: refs/tags/tag2
582 - EOF
586 + if test_have_prereq ICONV
587 + then
588 + cat <<-EOF >expected
589 + $head2 tag: refs/tags/message-one
590 + $old_head1 tag: refs/tags/message-two
591 + $head1 tag: refs/tags/tag2
592 + EOF
593 + else
594 + cat <<-EOF >expected
595 + $head2 tag: refs/tags/message-one
596 + $old_head1 tag: refs/tags/tag2, tag: refs/tags/message-two
597 + EOF
598 + fi &&
599 sort -k3 actual >actual1 &&
600 test_cmp expected actual1
601 '
t/t4210-log-i18n.sh
+6
@@ -5,6 +5,12 @@ test_description='test log with i18n features'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./lib-gettext.sh
7
8 +if ! test_have_prereq ICONV
9 +then
10 + skip_all='skipping log i18n tests; iconv not available'
11 + test_done
12 +fi
13 +
14 # two forms of é
15 utf8_e=$(printf '\303\251')
16 latin1_e=$(printf '\351')
t/t4254-am-corrupt.sh
+6
@@ -5,6 +5,12 @@ test_description='git am with corrupt input'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
7
8 +if ! test_have_prereq ICONV
9 +then
10 + skip_all='skipping am encoding corruption tests; iconv not available'
11 + test_done
12 +fi
13 +
14 make_mbox_with_nul () {
15 space=' '
16 q_nul_in_subject=
t/t5100-mailinfo.sh
+12 -2
@@ -28,7 +28,12 @@ check_mailinfo () {
28
29 for mail in 00*
30 do
31 - test_expect_success "mailinfo $mail" '
31 + case "$mail" in
32 + 0004)
33 + prereq=ICONV;;
34 + esac
35 +
36 + test_expect_success $prereq "mailinfo $mail" '
37 check_mailinfo "$mail" "" &&
38 if test -f "$DATA/msg$mail--scissors"
39 then
@@ -56,7 +61,12 @@ test_expect_success 'split box with rfc2047 samples' \
61
62 for mail in rfc2047/00*
63 do
59 - test_expect_success "mailinfo $mail" '
64 + case "$mail" in
65 + rfc2047/0001)
66 + prereq=ICONV;;
67 + esac
68 +
69 + test_expect_success $prereq "mailinfo $mail" '
70 git mailinfo -u "$mail-msg" "$mail-patch" <"$mail" >"$mail-info" &&
71 echo msg &&
72 test_cmp "$DATA/empty" "$mail-msg" &&
t/t5550-http-fetch-dumb.sh
+2 -2
@@ -344,12 +344,12 @@ test_expect_success 'git client shows text/plain with a charset' '
344 grep "this is the error message" stderr
345 '
346
347 -test_expect_success 'http error messages are reencoded' '
347 +test_expect_success ICONV 'http error messages are reencoded' '
348 test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
349 grep "this is the error message" stderr
350 '
351
352 -test_expect_success 'reencoding is robust to whitespace oddities' '
352 +test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
353 test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
354 grep "this is the error message" stderr
355 '
t/t6006-rev-list-format.sh
+37 -17
@@ -13,21 +13,41 @@ TEST_PASSES_SANITIZE_LEAK=true
13 . "$TEST_DIRECTORY"/lib-terminal.sh
14
15 test_tick
16 -# Tested non-UTF-8 encoding
17 -test_encoding="ISO8859-1"
18 -
19 -# String "added" in German
20 -# (translated with Google Translate),
21 -# encoded in UTF-8, used as a commit log message below.
22 -added_utf8_part=$(printf "\303\274")
23 -added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
24 -added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
25 -added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
26 -# same but "changed"
27 -changed_utf8_part=$(printf "\303\244")
28 -changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
29 -changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
30 -changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
16 +
17 +if test_have_prereq ICONV
18 +then
19 + # Tested non-UTF-8 encoding
20 + test_encoding="ISO8859-1"
21 +
22 + # String "added" in German
23 + # (translated with Google Translate),
24 + # encoded in UTF-8, used as a commit log message below.
25 + added_utf8_part=$(printf "\303\274")
26 + added_utf8_part_iso88591=$(echo "$added_utf8_part" | iconv -f utf-8 -t $test_encoding)
27 + added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
28 + added_iso88591=$(echo "$added" | iconv -f utf-8 -t $test_encoding)
29 + # same but "changed"
30 + changed_utf8_part=$(printf "\303\244")
31 + changed_utf8_part_iso88591=$(echo "$changed_utf8_part" | iconv -f utf-8 -t $test_encoding)
32 + changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
33 + changed_iso88591=$(echo "$changed" | iconv -f utf-8 -t $test_encoding)
34 +else
35 + # Tested non-UTF-8 encoding
36 + test_encoding="UTF-8"
37 +
38 + # String "added" in German
39 + # (translated with Google Translate),
40 + # encoded in UTF-8, used as a commit log message below.
41 + added_utf8_part="u"
42 + added_utf8_part_iso88591="u"
43 + added=$(printf "added (hinzugef${added_utf8_part}gt) foo")
44 + added_iso88591="$added"
45 + # same but "changed"
46 + changed_utf8_part="a"
47 + changed_utf8_part_iso88591="a"
48 + changed=$(printf "changed (ge${changed_utf8_part}ndert) foo")
49 + changed_iso88591="$changed"
50 +fi
51
52 # Count of char to truncate
53 # Number is chosen so, that non-ACSII characters
@@ -198,7 +218,7 @@ Thu, 7 Apr 2005 15:13:13 -0700
218 1112911993
219 EOF
220
201 -test_format encoding %e <<EOF
221 +test_format ICONV encoding %e <<EOF
222 commit $head2
223 $test_encoding
224 commit $head1
@@ -374,7 +394,7 @@ test_expect_success 'setup complex body' '
394 head3_short=$(git rev-parse --short $head3)
395 '
396
377 -test_format complex-encoding %e <<EOF
397 +test_format ICONV complex-encoding %e <<EOF
398 commit $head3
399 $test_encoding
400 commit $head2
t/t7102-reset.sh
+25 -15
@@ -13,21 +13,31 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
13 TEST_PASSES_SANITIZE_LEAK=true
14 . ./test-lib.sh
15
16 -commit_msg () {
17 - # String "modify 2nd file (changed)" partly in German
18 - # (translated with Google Translate),
19 - # encoded in UTF-8, used as a commit log message below.
20 - msg="modify 2nd file (ge\303\244ndert)\n"
21 - if test -n "$1"
22 - then
23 - printf "$msg" | iconv -f utf-8 -t "$1"
24 - else
25 - printf "$msg"
26 - fi
27 -}
28 -
29 -# Tested non-UTF-8 encoding
30 -test_encoding="ISO8859-1"
16 +if test_have_prereq ICONV
17 +then
18 + commit_msg () {
19 + # String "modify 2nd file (changed)" partly in German
20 + # (translated with Google Translate),
21 + # encoded in UTF-8, used as a commit log message below.
22 + msg="modify 2nd file (ge\303\244ndert)\n"
23 + if test -n "$1"
24 + then
25 + printf "$msg" | iconv -f utf-8 -t "$1"
26 + else
27 + printf "$msg"
28 + fi
29 + }
30 +
31 + # Tested non-UTF-8 encoding
32 + test_encoding="ISO8859-1"
33 +else
34 + commit_msg () {
35 + echo "modify 2nd file (geandert)"
36 + }
37 +
38 + # Tested non-UTF-8 encoding
39 + test_encoding="UTF-8"
40 +fi
41
42 test_expect_success 'creating initial files and commits' '
43 test_tick &&
t/t8005-blame-i18n.sh
+6
@@ -3,6 +3,12 @@
3 test_description='git blame encoding conversion'
4 . ./test-lib.sh
5
6 +if ! test_have_prereq ICONV
7 +then
8 + skip_all='skipping blame i18n tests; iconv not available'
9 + test_done
10 +fi
11 +
12 . "$TEST_DIRECTORY"/t8005/utf8.txt
13 . "$TEST_DIRECTORY"/t8005/euc-japan.txt
14 . "$TEST_DIRECTORY"/t8005/sjis.txt
t/t9300-fast-import.sh
+1 -1
@@ -3676,7 +3676,7 @@ test_expect_success !MINGW 'W: get-mark & empty orphan commit with erroneous thi
3676 ### series X (other new features)
3677 ###
3678
3679 -test_expect_success 'X: handling encoding' '
3679 +test_expect_success ICONV 'X: handling encoding' '
3680 test_tick &&
3681 cat >input <<-INPUT_END &&
3682 commit refs/heads/encoding
t/t9350-fast-export.sh
+5 -5
@@ -125,7 +125,7 @@ test_expect_success 'fast-export --show-original-ids | git fast-import' '
125 test $MUSS = $(git rev-parse --verify refs/tags/muss)
126 '
127
128 -test_expect_success 'reencoding iso-8859-7' '
128 +test_expect_success ICONV 'reencoding iso-8859-7' '
129
130 test_when_finished "git reset --hard HEAD~1" &&
131 test_config i18n.commitencoding iso-8859-7 &&
@@ -421,7 +421,7 @@ M 100644 :1 there
421
422 EOF
423
424 -test_expect_success 'dropping tag of filtered out object' '
424 +test_expect_success ICONV 'dropping tag of filtered out object' '
425 (
426 cd limit-by-paths &&
427 git fast-export --tag-of-filtered-object=drop mytag -- there > output &&
@@ -438,7 +438,7 @@ msg
438
439 EOF
440
441 -test_expect_success 'rewriting tag of filtered out object' '
441 +test_expect_success ICONV 'rewriting tag of filtered out object' '
442 (
443 cd limit-by-paths &&
444 git fast-export --tag-of-filtered-object=rewrite mytag -- there > output &&
@@ -667,7 +667,7 @@ M 100644 :13 file
667
668 EOF
669
670 -test_expect_success 'avoid uninteresting refs' '
670 +test_expect_success ICONV 'avoid uninteresting refs' '
671 > tmp-marks &&
672 git fast-export --import-marks=tmp-marks \
673 --export-marks=tmp-marks main > /dev/null &&
@@ -686,7 +686,7 @@ from :14
686
687 EOF
688
689 -test_expect_success 'refs are updated even if no commits need to be exported' '
689 +test_expect_success ICONV 'refs are updated even if no commits need to be exported' '
690 > tmp-marks &&
691 git fast-export --import-marks=tmp-marks \
692 --export-marks=tmp-marks main > /dev/null &&
t/test-lib.sh
+1
@@ -1743,6 +1743,7 @@ esac
1743
1744 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
1745 test -z "$NO_CURL" && test_set_prereq LIBCURL
1746 +test -z "$NO_ICONV" && test_set_prereq ICONV
1747 test -z "$NO_PERL" && test_set_prereq PERL
1748 test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
1749 test -z "$NO_PYTHON" && test_set_prereq PYTHON