threads / patch / 64957

patch, 4 partsFix tests with missing iconv(1) executable

Subject: [PATCH 0/4] Fix tests with missing iconv(1) executable

## tl;dr

38 messages between Feb 9, 2026 and Feb 20, 2026. Diffs are folded; open one to read it.

replies: 37people: 5as markdown or json

Patrick Steinhardt· Feb 9, 2026, 12:42 UTC · lore
Hi,

I recently noticed that th MSVC-based tests in GitLab CI started to fail. The root cause is that the iconv(1) executable cannot be found on this platform anymore. This isn't entirely surprising: we depend on the Git for Windows environment to provide necessary shell tools, and that environment of course is not a fully fledged MSYS2 installation.

In any case, this patch series fixes those issues by building on top of the ICONV prerequisite. If the prereq isn't found, then we also don't assume that the iconv(1) executable exists.

An alternative strategy would be to introduce a new ICONV_EXECUTABLE prereq. But given that Git doesn't perform any kind of reencoding itself in case the ICONV support isn't built into it I found it to not be worth the additional hassle.

In any case, this patch series causes the MSVC jobs to pass again on GitLab CI.

Thanks!
Patrick
---
Patrick Steinhardt (4):
      t4xxx: don't use iconv(1) without ICONV prereq
      t4205: improve handling of ICONV prerequisite
      t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
      t6006: don't use iconv(1) without ICONV prereq
 t/t4041-diff-submodule-option.sh             |  8 +++--
 t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
 t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
 t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
 t/t5550-http-fetch-dumb.sh                   | 20 +++++------
 t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
 6 files changed, 77 insertions(+), 46 deletions(-)

--- base-commit: 3e0db84c88c57e70ac8be8c196dfa92c5d656fbc change-id: 20260209-b4-pks-ci-msvc-iconv-fixes-13de4801643f

Patrick Steinhardt· Feb 9, 2026, 12:42 UTC · re: Patrick Steinhardt · lore

[PATCH 1/4] t4xxx: don't use iconv(1) without ICONV prereq

We've got a couple of tests that all use the iconv(1) executable to convert the encoding of a commit message. All of these tests are prepared to handle a missing ICONV prereq, in which case they will simply use UTF-8 encoding.

But even if the ICONV prerequisite has failed we try to use the iconv(1) executable. But it's not a safe to assume that the executable exists in that case. And besides that, it's also unnecessary to use iconv(1) in the first place, as we would only use it to convert from UTF-8 to UTF-8, which should be equivalent to a no-op.

Fix the issue and skip the call to iconv(1) in case the prerequisite is not set. This makes tests work on systems that don't have iconv at all.

Note that arguably, it's even unsafe to assume that the iconv(1) executable exists only because Git has been built with support for it. A more wholistic approach would thus be to split up the ICONV prereq into two prereqs: one that tells us whether Git has been built with ICONV support, and one that tells us whether the iconv(1) executable exists. But that would lead to a bunch of changes throughout our tests, and for arguably negligible benefit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4041-diff-submodule-option.sh             | 8 ++++++--
 t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
 t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)
Show changes to 3 files +18 −6

t/t4041-diff-submodule-option.sh, t/t4059-diff-submodule-not-initialized.sh, t/t4060-diff-submodule-option-diff-format.sh

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 4d4aa1650f..4dd4954260 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -37,8 +37,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 0fe81056d5..bb902ce94d 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index dbfeb7470b..d8f9213255 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
-- 
2.53.0.295.g64333814d3.dirty
Junio C Hamano· Feb 9, 2026, 17:55 UTC · re: Patrick Steinhardt · lore

Re: [PATCH 1/4] t4xxx: don't use iconv(1) without ICONV prereq

Patrick Steinhardt <ps@pks.im> writes:
Show 28 quoted lines
> We've got a couple of tests that all use the iconv(1) executable to
> convert the encoding of a commit message. All of these tests are
> prepared to handle a missing ICONV prereq, in which case they will
> simply use UTF-8 encoding.
>
> But even if the ICONV prerequisite has failed we try to use the iconv(1)
> executable. But it's not a safe to assume that the executable exists in
> that case. And besides that, it's also unnecessary to use iconv(1) in
> the first place, as we would only use it to convert from UTF-8 to UTF-8,
> which should be equivalent to a no-op.
>
> Fix the issue and skip the call to iconv(1) in case the prerequisite is
> not set. This makes tests work on systems that don't have iconv at all.
>
> Note that arguably, it's even unsafe to assume that the iconv(1)
> executable exists only because Git has been built with support for it.
> A more wholistic approach would thus be to split up the ICONV prereq
> into two prereqs: one that tells us whether Git has been built with
> ICONV support, and one that tells us whether the iconv(1) executable
> exists. But that would lead to a bunch of changes throughout our tests,
> and for arguably negligible benefit.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  t/t4041-diff-submodule-option.sh             | 8 ++++++--
>  t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
>  t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
>  3 files changed, 18 insertions(+), 6 deletions(-)
The repetition across three files look a bit disturbing X-<.
Show 16 quoted lines
> diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
> index 4d4aa1650f..4dd4954260 100755
> --- a/t/t4041-diff-submodule-option.sh
> +++ b/t/t4041-diff-submodule-option.sh
> @@ -37,8 +37,12 @@ add_file () {
>  			test_tick &&
>  			# "git commit -m" would break MinGW, as Windows refuse to pass
>  			# $test_encoding encoded parameter to git.
> -			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
> -			git -c "i18n.commitEncoding=$test_encoding" commit -F -
> +			message="Add $name ($added $name)" &&
> +			if test_have_prereq ICONV
> +			then
> +				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
> +			fi &&
> +			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -

This was a bit unexpected. Do we give any guarantee to builds that lack iconv support that "git -c i18n.commitEncoding=... commit" will pass the payload verbatim? I would have expected ICONV prerequisite is used on the whole test_expect_success to exclude the tests that are affected, not at such a low level.

Torsten Bögershausen· Feb 10, 2026, 11:14 UTC · re: Junio C Hamano · lore

Re: [PATCH 1/4] t4xxx: don't use iconv(1) without ICONV prereq

On Mon, Feb 09, 2026 at 09:55:10AM -0800, Junio C Hamano wrote:
Show 56 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > We've got a couple of tests that all use the iconv(1) executable to
> > convert the encoding of a commit message. All of these tests are
> > prepared to handle a missing ICONV prereq, in which case they will
> > simply use UTF-8 encoding.
> >
> > But even if the ICONV prerequisite has failed we try to use the iconv(1)
> > executable. But it's not a safe to assume that the executable exists in
> > that case. And besides that, it's also unnecessary to use iconv(1) in
> > the first place, as we would only use it to convert from UTF-8 to UTF-8,
> > which should be equivalent to a no-op.
> >
> > Fix the issue and skip the call to iconv(1) in case the prerequisite is
> > not set. This makes tests work on systems that don't have iconv at all.
> >
> > Note that arguably, it's even unsafe to assume that the iconv(1)
> > executable exists only because Git has been built with support for it.
> > A more wholistic approach would thus be to split up the ICONV prereq
> > into two prereqs: one that tells us whether Git has been built with
> > ICONV support, and one that tells us whether the iconv(1) executable
> > exists. But that would lead to a bunch of changes throughout our tests,
> > and for arguably negligible benefit.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> >  t/t4041-diff-submodule-option.sh             | 8 ++++++--
> >  t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
> >  t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
> >  3 files changed, 18 insertions(+), 6 deletions(-)
> 
> The repetition across three files look a bit disturbing X-<.
> 
> > diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
> > index 4d4aa1650f..4dd4954260 100755
> > --- a/t/t4041-diff-submodule-option.sh
> > +++ b/t/t4041-diff-submodule-option.sh
> > @@ -37,8 +37,12 @@ add_file () {
> >  			test_tick &&
> >  			# "git commit -m" would break MinGW, as Windows refuse to pass
> >  			# $test_encoding encoded parameter to git.
> > -			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
> > -			git -c "i18n.commitEncoding=$test_encoding" commit -F -
> > +			message="Add $name ($added $name)" &&
> > +			if test_have_prereq ICONV
> > +			then
> > +				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
> > +			fi &&
> > +			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
> 
> This was a bit unexpected.  Do we give any guarantee to builds that
> lack iconv support that "git -c i18n.commitEncoding=... commit" will
> pass the payload verbatim?  I would have expected ICONV prerequisite
> is used on the whole test_expect_success to exclude the tests that
> are affected, not at such a low level.
> 
To my understanding there are 2 different things:
- Does the platform have libiconv (which is linked into Git,
   and handles the commit encoding)
- Does the platform ship the iconv binary ?
  It seems as if mingw has stopped to ship the iconv binary.
  And as a result, Git for Windows is missing it, too.
(And if someone asks me: it probably makes sense to bring it back)
https://github.com/git-for-windows/git/issues/6083
Patrick Steinhardt· Feb 10, 2026, 14:12 UTC · re: Torsten Bögershausen · lore

Re: [PATCH 1/4] t4xxx: don't use iconv(1) without ICONV prereq

On Tue, Feb 10, 2026 at 12:14:01PM +0100, Torsten Bögershausen wrote:
Show 33 quoted lines
> On Mon, Feb 09, 2026 at 09:55:10AM -0800, Junio C Hamano wrote:
> > Patrick Steinhardt <ps@pks.im> writes:
> > 
> > > We've got a couple of tests that all use the iconv(1) executable to
> > > convert the encoding of a commit message. All of these tests are
> > > prepared to handle a missing ICONV prereq, in which case they will
> > > simply use UTF-8 encoding.
> > >
> > > But even if the ICONV prerequisite has failed we try to use the iconv(1)
> > > executable. But it's not a safe to assume that the executable exists in
> > > that case. And besides that, it's also unnecessary to use iconv(1) in
> > > the first place, as we would only use it to convert from UTF-8 to UTF-8,
> > > which should be equivalent to a no-op.
> > >
> > > Fix the issue and skip the call to iconv(1) in case the prerequisite is
> > > not set. This makes tests work on systems that don't have iconv at all.
> > >
> > > Note that arguably, it's even unsafe to assume that the iconv(1)
> > > executable exists only because Git has been built with support for it.
> > > A more wholistic approach would thus be to split up the ICONV prereq
> > > into two prereqs: one that tells us whether Git has been built with
> > > ICONV support, and one that tells us whether the iconv(1) executable
> > > exists. But that would lead to a bunch of changes throughout our tests,
> > > and for arguably negligible benefit.
> > >
> > > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > > ---
> > >  t/t4041-diff-submodule-option.sh             | 8 ++++++--
> > >  t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
> > >  t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
> > >  3 files changed, 18 insertions(+), 6 deletions(-)
> > 
> > The repetition across three files look a bit disturbing X-<.

Yeah, agreed. I was wondering whether I should have another preparatory commit that deduplicates the logic, but ultimately I cared more about fixing the CI failures that we currrently face.

Show 20 quoted lines
> > > diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
> > > index 4d4aa1650f..4dd4954260 100755
> > > --- a/t/t4041-diff-submodule-option.sh
> > > +++ b/t/t4041-diff-submodule-option.sh
> > > @@ -37,8 +37,12 @@ add_file () {
> > >  			test_tick &&
> > >  			# "git commit -m" would break MinGW, as Windows refuse to pass
> > >  			# $test_encoding encoded parameter to git.
> > > -			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
> > > -			git -c "i18n.commitEncoding=$test_encoding" commit -F -
> > > +			message="Add $name ($added $name)" &&
> > > +			if test_have_prereq ICONV
> > > +			then
> > > +				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
> > > +			fi &&
> > > +			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
> > 
> > This was a bit unexpected.  Do we give any guarantee to builds that
> > lack iconv support that "git -c i18n.commitEncoding=... commit" will
> > pass the payload verbatim?  

In case the ICONV prereq is false we set up "UTF-8" as test encoding. And UTF-8 is also the default encoding that we also specify in case the above configuration hasn't been set, see `get_commit_output_encoding()`. So this would essentially be a no-op and is expected to behave the exact same as if the configuration wasn't set.

> > I would have expected ICONV prerequisite is used on the whole
> > test_expect_success to exclude the tests that are affected, not at
> > such a low level.

The thing is that many of the tests are actually things that we really want to test regardless of whether or not we have the ICONV prereq. They aren't inherently specific to any specific encoding, even though we _also_ verify that the encoding works as expected.

I didn't want to decrease test coverage, so I tried to only add ICONV prerequisites where tests couldn't be trivially made to pass without the binary.

Show 10 quoted lines
> To my understanding there are 2 different things:
> - Does the platform have libiconv (which is linked into Git,
>    and handles the commit encoding)
> - Does the platform ship the iconv binary ?
>   It seems as if mingw has stopped to ship the iconv binary.
>   And as a result, Git for Windows is missing it, too.
> 
> (And if someone asks me: it probably makes sense to bring it back)
> 
> https://github.com/git-for-windows/git/issues/6083

Yeah, this change in GfW is indeed the root cause of the CI failures. But even if the iconv binary were to come back I think it's somewhat sensible to assume that the iconv(1) binary may not exist when built with NO_ICONV. There might for example be platforms out there that have no iconv support at all, and the patches in this series would help those.

Thanks!
Patrick
Junio C Hamano· Feb 10, 2026, 15:43 UTC · re: Patrick Steinhardt · lore

Re: [PATCH 1/4] t4xxx: don't use iconv(1) without ICONV prereq

Patrick Steinhardt <ps@pks.im> writes:
Show 5 quoted lines
> But even if the iconv binary were to come back I think it's somewhat
> sensible to assume that the iconv(1) binary may not exist when built
> with NO_ICONV. There might for example be platforms out there that have
> no iconv support at all, and the patches in this series would help
> those.
Makes sense.  Thanks.
Patrick Steinhardt· Feb 9, 2026, 12:42 UTC · re: Patrick Steinhardt · lore

[PATCH 2/4] t4205: improve handling of ICONV prerequisite

In t4205 we have a bunch of tests that depend on the iconv prereq. This is for most of the part because we format commit messages that have been encoded in an encoding different than UTF-8.

Those tests fall into two classes though:
  - One class of tests outputs the data as-is without reencoding.
  - One class of tests outputs the data with "i18n.logOutputEncoding" to
    reencode it.

Curiously enough, both of these classes are marked with the ICONV prereq, even though one might expect that the first class wouldn't need the prereq. This is because we unconditionally use ISO-8859-1 encoding for the initial commit message, and thus we depend on converting to UTF-8 indeed.

This creates another problem though: when the iconv(1) executable does not exist the test setup fails, even in the case where the ICONV prereq has not been set.

Fix these issues by making the test encoding conditional on ICONV: if it's available we use ISO-8859-1, otherwise we use UTF-8. This fixes the test setup on platforms without iconv(1), and it allows us to drop the ICONV prereq from a bunch of tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4205-log-pretty-formats.sh | 50 ++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Show changes to t/t4205-log-pretty-formats.sh +28 −22
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 8f2ba98963..3865f6abc7 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -9,7 +9,12 @@ test_description='Test pretty formats'
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+if test_have_prereq ICONV
+then
+	test_encoding="ISO8859-1"
+else
+	test_encoding="UTF-8"
+fi
 
 sample_utf8_part=$(printf "f\303\244ng")
 
@@ -18,7 +23,7 @@ commit_msg () {
 	# (translated with Google Translate),
 	# encoded in UTF-8, used as a commit log message below.
 	msg="initial. an${sample_utf8_part}lich\n"
-	if test -n "$1"
+	if test -n "$1" && test "$1" != "UTF-8"
 	then
 		printf "$msg" | iconv -f utf-8 -t "$1"
 	else
@@ -113,19 +118,19 @@ test_expect_success 'alias loop' '
 	test_must_fail git log --pretty=test-foo
 '
 
-test_expect_success ICONV 'NUL separation' '
+test_expect_success 'NUL separation' '
 	printf "add bar\0$(commit_msg)" >expected &&
 	git log -z --pretty="format:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL termination' '
+test_expect_success 'NUL termination' '
 	printf "add bar\0$(commit_msg)\0" >expected &&
 	git log -z --pretty="tformat:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL separation with --stat' '
+test_expect_success 'NUL separation with --stat' '
 	stat0_part=$(git diff --stat HEAD^ HEAD) &&
 	stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -180,7 +185,7 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success ICONV 'left alignment formatting' '
+test_expect_success 'left alignment formatting' '
 	git log --pretty="tformat:%<(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	message two                            Z
@@ -202,7 +207,7 @@ test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %<|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -213,7 +218,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -235,7 +240,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column. i18n.log
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with no padding' '
+test_expect_success 'left alignment formatting with no padding' '
 	git log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -246,7 +251,7 @@ test_expect_success ICONV 'left alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with no padding. i18n.logOutputEncoding' '
 	git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
 	message two
@@ -257,7 +262,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with trunc' '
+test_expect_success 'left alignment formatting with trunc' '
 	git log --pretty="tformat:%<(10,trunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	message ..
@@ -279,7 +284,7 @@ test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputE
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with ltrunc' '
+test_expect_success 'left alignment formatting with ltrunc' '
 	git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	..sage two
@@ -301,7 +306,7 @@ test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with mtrunc' '
+test_expect_success 'left alignment formatting with mtrunc' '
 	git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	mess.. two
@@ -323,7 +328,7 @@ test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting' '
+test_expect_success 'right alignment formatting' '
 	git log --pretty="tformat:%>(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z                            message two
@@ -345,7 +350,7 @@ test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %>|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -356,7 +361,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -391,7 +396,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column with --g
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding' '
+test_expect_success 'right alignment formatting with no padding' '
 	git log --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -402,7 +407,7 @@ test_expect_success ICONV 'right alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
+test_expect_success 'right alignment formatting with no padding and with --graph' '
 	git log --graph --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	* message two
@@ -424,7 +429,7 @@ test_expect_success ICONV 'right alignment formatting with no padding. i18n.logO
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting' '
+test_expect_success 'center alignment formatting' '
 	git log --pretty="tformat:%><(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z             message two              Z
@@ -445,7 +450,8 @@ test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding'
 	EOF
 	test_cmp expected actual
 '
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+
+test_expect_success 'center alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %><|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -456,7 +462,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+test_expect_success 'center alignment formatting at the nth column' '
 	COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -478,7 +484,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column. i18n.l
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting with no padding' '
+test_expect_success 'center alignment formatting with no padding' '
 	git log --pretty="tformat:%><(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
-- 
2.53.0.295.g64333814d3.dirty
Patrick Steinhardt· Feb 9, 2026, 12:42 UTC · re: Patrick Steinhardt · lore

[PATCH 3/4] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error" to ensure that error messages are proprely forwarded. This URL executes the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1) executable to reencode the message.

This executable may not exist on platforms, which will make the tests fail. Guard them with the ICONV prereq to fix such failures.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t5550-http-fetch-dumb.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Show changes to t/t5550-http-fetch-dumb.sh +10 −10
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index ed0ad66fad..55102e702c 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
 '
 
 test_expect_success 'did not use upload-pack service' '
-	! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
+	! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
 '
 
-test_expect_success 'git client shows text/plain errors' '
+test_expect_success ICONV 'git client shows text/plain errors' '
 	test_must_fail git clone "$HTTPD_URL/error/text" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client does not show html errors' '
+test_expect_success ICONV 'git client does not show html errors' '
 	test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
-	! grep "this is the error message" stderr
+	! test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client shows text/plain with a charset' '
+test_expect_success ICONV 'git client shows text/plain with a charset' '
 	test_must_fail git clone "$HTTPD_URL/error/charset" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'http error messages are reencoded' '
 	test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
 	test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 check_language () {
@@ -406,7 +406,7 @@ ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
 
 test_expect_success 'git client send an empty Accept-Language' '
 	GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
-	! grep "^=> Send header: Accept-Language:" stderr
+	! test_grep "^=> Send header: Accept-Language:" stderr
 '
 
 test_expect_success 'remote-http complains cleanly about malformed urls' '
-- 
2.53.0.295.g64333814d3.dirty
Patrick Steinhardt· Feb 9, 2026, 12:42 UTC · re: Patrick Steinhardt · lore

[PATCH 4/4] t6006: don't use iconv(1) without ICONV prereq

Two tests in t6006 depend on the iconv(1) prerequisite to reencode a commit message. This executable may not even exist though in case the prereq is not set, which will cause the tests to fail.

Fix this by using UTF-8 instead when the prereq is not set.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t6006-rev-list-format.sh | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
Show changes to t/t6006-rev-list-format.sh +21 −8
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index eb93d68d7d..581984467d 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -378,15 +378,23 @@ test_expect_success 'rev-list %C(auto,...) respects --color' '
 	test_cmp expect actual
 '
 
-iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
-Test printing of complex bodies
+test_expect_success 'setup complex body' '
+	message=$(cat <<-EOF
+	Test printing of complex bodies
 
-This commit message is much longer than the others,
-and it will be encoded in $test_encoding. We should therefore
-include an ISO8859 character: ¡bueno!
-EOF
+	This commit message is much longer than the others,
+	and it will be encoded in $test_encoding. We should therefore
+	include an ISO8859 character: ¡bueno!
+	EOF
+	) &&
+
+	if test_have_prereq ICONV
+	then
+		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
+	else
+		echo "$message" >commit-msg
+	fi &&
 
-test_expect_success 'setup complex body' '
 	git config i18n.commitencoding $test_encoding &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
@@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
 	commit $head2
 	commit $head1
 	EOF
-	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	if test_have_prereq ICONV
+	then
+		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	else
+		cp expected.utf-8 expected.ISO8859-1
+	fi
 '
 
 test_format complex-body %b <expected.ISO8859-1
-- 
2.53.0.295.g64333814d3.dirty
Christian Couder· Feb 16, 2026, 08:57 UTC · re: Patrick Steinhardt · lore

Re: [PATCH 0/4] Fix tests with missing iconv(1) executable

Hi,
On Mon, Feb 9, 2026 at 1:42 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 12 quoted lines
>
> Hi,
>
> I recently noticed that th MSVC-based tests in GitLab CI started to
> fail. The root cause is that the iconv(1) executable cannot be found on
> this platform anymore. This isn't entirely surprising: we depend on the
> Git for Windows environment to provide necessary shell tools, and that
> environment of course is not a fully fledged MSYS2 installation.
>
> In any case, this patch series fixes those issues by building on top of
> the ICONV prerequisite. If the prereq isn't found, then we also don't
> assume that the iconv(1) executable exists.

I think it's reasonable to assume that iconv isn't available if the ICONV prereq isn't satisfied.

> An alternative strategy would be to introduce a new ICONV_EXECUTABLE
> prereq. But given that Git doesn't perform any kind of reencoding itself
> in case the ICONV support isn't built into it I found it to not be worth
> the additional hassle.

I agree that it's better to not add a new ICONV_EXECUTABLE prereq if possible, as it keeps things simple.

> In any case, this patch series causes the MSVC jobs to pass again on
> GitLab CI.

I think it would be nice if this could talk a bit about the NO_ICONV build knob and how it still relates to the ICONV prereq though.

Before this series, for example, the Makefile says:
  # Define NO_ICONV if your libc does not properly support iconv.
while t/test-lib.sh has:
  test -z "$NO_ICONV" && test_set_prereq ICONV
Unfortunately the diffstat below:
Show 7 quoted lines
>  t/t4041-diff-submodule-option.sh             |  8 +++--
>  t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
>  t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
>  t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
>  t/t5550-http-fetch-dumb.sh                   | 20 +++++------
>  t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
>  6 files changed, 77 insertions(+), 46 deletions(-)

shows no change in the Makefile, or any build infrastructure file, despite the fact that the series changes the one-to-one relationship between the NO_ICONV build knob and the ICONV prereq.

In the Makefile, for example, I think something like the following would be nice:

Show changes to Makefile +3 −1
diff --git a/Makefile b/Makefile
index 47ed9fa7fd..ed54071fd7 100644
--- a/Makefile
+++ b/Makefile
@@ -182,7 +182,9 @@ include shared.mak
# Define NO_SOCKADDR_STORAGE if your platform does not have struct
# sockaddr_storage.
#
-# Define NO_ICONV if your libc does not properly support iconv.
+# Define NO_ICONV if your libc does not properly support iconv. Note that for
+# simplicity the test suite assumes that iconv(1) is available if and only if
+# NO_ICONV is not defined.
#
# Define OLD_ICONV if your library has an old iconv(), where the second
# (input buffer pointer) parameter is declared with type (const char **).

Not sure how a similar update should be done in configure.ac or
meson.build but maybe it might be worth clarifying things there too.

On the other hand maybe we can say that the situation regarding the
documentation of iconv(1) and the build knobs was quite bad before
this series already and that a full separate patch series would be
required to improve on that. But I think at least this cover letter
should say that.
Patrick Steinhardt· Feb 17, 2026, 11:54 UTC · re: Christian Couder · lore

Re: [PATCH 0/4] Fix tests with missing iconv(1) executable

On Mon, Feb 16, 2026 at 09:57:33AM +0100, Christian Couder wrote:
Show 31 quoted lines
> On Mon, Feb 9, 2026 at 1:42 PM Patrick Steinhardt <ps@pks.im> wrote:
> > In any case, this patch series causes the MSVC jobs to pass again on
> > GitLab CI.
> 
> I think it would be nice if this could talk a bit about the NO_ICONV
> build knob and how it still relates to the ICONV prereq though.
> 
> Before this series, for example, the Makefile says:
> 
>   # Define NO_ICONV if your libc does not properly support iconv.
> 
> while t/test-lib.sh has:
> 
>   test -z "$NO_ICONV" && test_set_prereq ICONV
> 
> Unfortunately the diffstat below:
> 
> >  t/t4041-diff-submodule-option.sh             |  8 +++--
> >  t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
> >  t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
> >  t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
> >  t/t5550-http-fetch-dumb.sh                   | 20 +++++------
> >  t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
> >  6 files changed, 77 insertions(+), 46 deletions(-)
> 
> shows no change in the Makefile, or any build infrastructure file,
> despite the fact that the series changes the one-to-one relationship
> between the NO_ICONV build knob and the ICONV prereq.
> 
> In the Makefile, for example, I think something like the following
> would be nice:

Agreed, it makes sense to document this. I'll do so in the test lib though, and also expand how we define the ICONV prerequisite to cover the new semantics.

Patrick
Christian Couder· Feb 16, 2026, 09:23 UTC · re: Patrick Steinhardt · lore

Re: [PATCH 0/4] Fix tests with missing iconv(1) executable

On Mon, Feb 9, 2026 at 1:42 PM Patrick Steinhardt <ps@pks.im> wrote:
>
> Hi,
>
> I recently noticed that th MSVC-based tests in GitLab CI started to
s/that th/that the/
> fail. The root cause is that the iconv(1) executable cannot be found on
> this platform anymore. This isn't entirely surprising: we depend on the
> Git for Windows environment to provide necessary shell tools, and that
> environment of course is not a fully fledged MSYS2 installation.

Maybe this and perhaps some commit messages of the patches in the series could also talk about https://github.com/git-for-windows/git/issues/6083 a bit now that we know it's related.

Except for this and the documentation issue in the build system I mentioned in my previous email, the patches in the series look good to me.

Thanks.
Patrick Steinhardt· Feb 17, 2026, 11:54 UTC · re: Christian Couder · lore

Re: [PATCH 0/4] Fix tests with missing iconv(1) executable

On Mon, Feb 16, 2026 at 10:23:16AM +0100, Christian Couder wrote:
Show 7 quoted lines
> On Mon, Feb 9, 2026 at 1:42 PM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > Hi,
> >
> > I recently noticed that th MSVC-based tests in GitLab CI started to
> 
> s/that th/that the/

Will fix, but given that this is the cover letter anyway I don't think it matters much.

Show 9 quoted lines
> > fail. The root cause is that the iconv(1) executable cannot be found on
> > this platform anymore. This isn't entirely surprising: we depend on the
> > Git for Windows environment to provide necessary shell tools, and that
> > environment of course is not a fully fledged MSYS2 installation.
> 
> Maybe this and perhaps some commit messages of the patches in the
> series could also talk about
> https://github.com/git-for-windows/git/issues/6083 a bit now that we
> know it's related.
Yup, makes sense.
Patrick
Patrick Steinhardt· Feb 17, 2026, 13:58 UTC · re: Patrick Steinhardt · lore

[PATCH v2 0/4] Fix tests with missing iconv(1) executable

Hi,

I recently noticed that the MSVC-based tests in GitLab CI started to fail. The root cause is that the iconv(1) executable cannot be found on this platform anymore. This isn't entirely surprising: we depend on the Git for Windows environment to provide necessary shell tools, and that environment of course is not a fully fledged MSYS2 installation.

In any case, this patch series fixes those issues by building on top of the ICONV prerequisite. If the prereq isn't found, then we also don't assume that the iconv(1) executable exists.

An alternative strategy would be to introduce a new ICONV_EXECUTABLE prereq. But given that Git doesn't perform any kind of reencoding itself in case the ICONV support isn't built into it I found it to not be worth the additional hassle.

In any case, this patch series causes the MSVC jobs to pass again on GitLab CI.

Changes in v2:
  - Extend the ICONV prerequisite to cover the new semantics and add a
    NEEDSWORK comment.
  - Mention the upstream issue in Git for Windows.
  - Link to v1: https://lore.kernel.org/r/20260209-b4-pks-ci-msvc-iconv-fixes-v1-0-1e3167cd8828@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (4):
      t4xxx: don't use iconv(1) without ICONV prereq
      t4205: improve handling of ICONV prerequisite
      t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
      t6006: don't use iconv(1) without ICONV prereq
 t/t4041-diff-submodule-option.sh             |  8 +++--
 t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
 t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
 t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
 t/t5550-http-fetch-dumb.sh                   | 20 +++++------
 t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
 t/test-lib.sh                                | 12 ++++++-
 7 files changed, 88 insertions(+), 47 deletions(-)
Range-diff versus v1:
1:  66ae888b34 ! 1:  0e26fa0f07 t4xxx: don't use iconv(1) without ICONV prereq
    @@ Commit message
         the first place, as we would only use it to convert from UTF-8 to UTF-8,
         which should be equivalent to a no-op.
     
    +    In fact, Git for Windows has recently (unintentionally) shipped a change
    +    where the iconv(1) binary is not getting installed anymore [1]. And as
    +    we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has
    +    exposed the issue. The missing iconv(1) binary is considered a bug that
    +    will be fixed in Git for Windows, but regardless of that it makes sense
    +    to not assume the binary to always exist.
    +
         Fix the issue and skip the call to iconv(1) in case the prerequisite is
         not set. This makes tests work on systems that don't have iconv at all.
    +    Extend the ICONV prerequisite to cover these new semantics so that we
    +    know to skip tests in case the iconv(1) binary doesn't exist.
     
    -    Note that arguably, it's even unsafe to assume that the iconv(1)
    -    executable exists only because Git has been built with support for it.
    -    A more wholistic approach would thus be to split up the ICONV prereq
    -    into two prereqs: one that tells us whether Git has been built with
    -    ICONV support, and one that tells us whether the iconv(1) executable
    -    exists. But that would lead to a bunch of changes throughout our tests,
    -    and for arguably negligible benefit.
    +    [1]: https://github.com/git-for-windows/git/issues/6083
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ t/t4060-diff-submodule-option-diff-format.sh: add_file () {
      		done >/dev/null &&
      		git rev-parse --short --verify HEAD
      	)
    +
    + ## t/test-lib.sh ##
    +@@ t/test-lib.sh: esac
    + ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
    + test -z "$NO_CURL" && test_set_prereq LIBCURL
    + test -z "$NO_GITWEB" && test_set_prereq GITWEB
    +-test -z "$NO_ICONV" && test_set_prereq ICONV
    + test -z "$NO_PERL" && test_set_prereq PERL
    + test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
    + test -z "$NO_PYTHON" && test_set_prereq PYTHON
    +@@ t/test-lib.sh: test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
    + test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
    + test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
    + 
    ++test_lazy_prereq ICONV '
    ++	# We require Git to be built with iconv support, and we require the
    ++	# iconv binary to exist.
    ++	#
    ++	# NEEDSWORK: We might eventually want to split this up into two
    ++	# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
    ++	# some tests only depend on either of these.
    ++	test -z "$NO_ICONV" &&
    ++	iconv -f utf8 -t utf8 </dev/null
    ++'
    ++
    + if test -z "$GIT_TEST_CHECK_CACHE_TREE"
    + then
    + 	GIT_TEST_CHECK_CACHE_TREE=true
2:  d5831c230e = 2:  ae4d582c53 t4205: improve handling of ICONV prerequisite
3:  a55d3b7ed4 = 3:  3c28d86b25 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
4:  28306e7c1e = 4:  b1f05d7725 t6006: don't use iconv(1) without ICONV prereq

--- base-commit: 3e0db84c88c57e70ac8be8c196dfa92c5d656fbc change-id: 20260209-b4-pks-ci-msvc-iconv-fixes-13de4801643f

Patrick Steinhardt· Feb 17, 2026, 13:58 UTC · re: Patrick Steinhardt · lore

[PATCH v2 1/4] t4xxx: don't use iconv(1) without ICONV prereq

We've got a couple of tests that all use the iconv(1) executable to convert the encoding of a commit message. All of these tests are prepared to handle a missing ICONV prereq, in which case they will simply use UTF-8 encoding.

But even if the ICONV prerequisite has failed we try to use the iconv(1) executable. But it's not a safe to assume that the executable exists in that case. And besides that, it's also unnecessary to use iconv(1) in the first place, as we would only use it to convert from UTF-8 to UTF-8, which should be equivalent to a no-op.

In fact, Git for Windows has recently (unintentionally) shipped a change where the iconv(1) binary is not getting installed anymore [1]. And as we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has exposed the issue. The missing iconv(1) binary is considered a bug that will be fixed in Git for Windows, but regardless of that it makes sense to not assume the binary to always exist.

Fix the issue and skip the call to iconv(1) in case the prerequisite is not set. This makes tests work on systems that don't have iconv at all. Extend the ICONV prerequisite to cover these new semantics so that we know to skip tests in case the iconv(1) binary doesn't exist.

[1]: https://github.com/git-for-windows/git/issues/6083
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4041-diff-submodule-option.sh             |  8 ++++++--
 t/t4059-diff-submodule-not-initialized.sh    |  8 ++++++--
 t/t4060-diff-submodule-option-diff-format.sh |  8 ++++++--
 t/test-lib.sh                                | 12 +++++++++++-
 4 files changed, 29 insertions(+), 7 deletions(-)
Show changes to 4 files +29 −7

t/t4041-diff-submodule-option.sh, t/t4059-diff-submodule-not-initialized.sh, t/t4060-diff-submodule-option-diff-format.sh, t/test-lib.sh

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 4d4aa1650f..4dd4954260 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -37,8 +37,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 0fe81056d5..bb902ce94d 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index dbfeb7470b..d8f9213255 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fb76f7d11..67d15ae079 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1720,7 +1720,6 @@ esac
 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
 test -z "$NO_CURL" && test_set_prereq LIBCURL
 test -z "$NO_GITWEB" && test_set_prereq GITWEB
-test -z "$NO_ICONV" && test_set_prereq ICONV
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
@@ -1731,6 +1730,17 @@ test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
 test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
 test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
 
+test_lazy_prereq ICONV '
+	# We require Git to be built with iconv support, and we require the
+	# iconv binary to exist.
+	#
+	# NEEDSWORK: We might eventually want to split this up into two
+	# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
+	# some tests only depend on either of these.
+	test -z "$NO_ICONV" &&
+	iconv -f utf8 -t utf8 </dev/null
+'
+
 if test -z "$GIT_TEST_CHECK_CACHE_TREE"
 then
 	GIT_TEST_CHECK_CACHE_TREE=true
-- 
2.53.0.352.gd1286b26eb.dirty
Christian Couder· Feb 17, 2026, 14:48 UTC · re: Patrick Steinhardt · lore

Re: [PATCH v2 1/4] t4xxx: don't use iconv(1) without ICONV prereq

On Tue, Feb 17, 2026 at 2:58 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 8 quoted lines
>
> We've got a couple of tests that all use the iconv(1) executable to
> convert the encoding of a commit message. All of these tests are
> prepared to handle a missing ICONV prereq, in which case they will
> simply use UTF-8 encoding.
>
> But even if the ICONV prerequisite has failed we try to use the iconv(1)
> executable. But it's not a safe to assume that the executable exists in
s/not a safe/not safe/
Show 13 quoted lines
> that case. And besides that, it's also unnecessary to use iconv(1) in
> the first place, as we would only use it to convert from UTF-8 to UTF-8,
> which should be equivalent to a no-op.
>
> In fact, Git for Windows has recently (unintentionally) shipped a change
> where the iconv(1) binary is not getting installed anymore [1]. And as
> we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has
> exposed the issue. The missing iconv(1) binary is considered a bug that
> will be fixed in Git for Windows, but regardless of that it makes sense
> to not assume the binary to always exist.
>
> Fix the issue and skip the call to iconv(1) in case the prerequisite is
> not set. This makes tests work on systems that don't have iconv at all.
Nit: when reading this, it's not clear if this commit is enough to fix
all the MSVC+Meson jobs in GitLab CI or only those related to the
t4xxx tests.
> Extend the ICONV prerequisite to cover these new semantics so that we
> know to skip tests in case the iconv(1) binary doesn't exist.
[...]
Show 10 quoted lines
> +test_lazy_prereq ICONV '
> +       # We require Git to be built with iconv support, and we require the
> +       # iconv binary to exist.
> +       #
> +       # NEEDSWORK: We might eventually want to split this up into two
> +       # prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
> +       # some tests only depend on either of these.
> +       test -z "$NO_ICONV" &&
> +       iconv -f utf8 -t utf8 </dev/null
> +'

Yeah, I think it works to actually test if iconv works and to document the small discrepancy between the ICONV prereq and NO_ICONV here.

Patrick Steinhardt· Feb 17, 2026, 15:18 UTC · re: Christian Couder · lore

Re: [PATCH v2 1/4] t4xxx: don't use iconv(1) without ICONV prereq

On Tue, Feb 17, 2026 at 03:48:19PM +0100, Christian Couder wrote:
Show 29 quoted lines
> On Tue, Feb 17, 2026 at 2:58 PM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > We've got a couple of tests that all use the iconv(1) executable to
> > convert the encoding of a commit message. All of these tests are
> > prepared to handle a missing ICONV prereq, in which case they will
> > simply use UTF-8 encoding.
> >
> > But even if the ICONV prerequisite has failed we try to use the iconv(1)
> > executable. But it's not a safe to assume that the executable exists in
> 
> s/not a safe/not safe/
> 
> > that case. And besides that, it's also unnecessary to use iconv(1) in
> > the first place, as we would only use it to convert from UTF-8 to UTF-8,
> > which should be equivalent to a no-op.
> >
> > In fact, Git for Windows has recently (unintentionally) shipped a change
> > where the iconv(1) binary is not getting installed anymore [1]. And as
> > we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has
> > exposed the issue. The missing iconv(1) binary is considered a bug that
> > will be fixed in Git for Windows, but regardless of that it makes sense
> > to not assume the binary to always exist.
> >
> > Fix the issue and skip the call to iconv(1) in case the prerequisite is
> > not set. This makes tests work on systems that don't have iconv at all.
> 
> Nit: when reading this, it's not clear if this commit is enough to fix
> all the MSVC+Meson jobs in GitLab CI or only those related to the
> t4xxx tests.

Yeah, fair. I think this is an artifact of me lumping these two changes together into a single commit. I'll split it up in v3 of this patch series.

Thanks!
Patrick
Patrick Steinhardt· Feb 17, 2026, 13:58 UTC · re: Patrick Steinhardt · lore

[PATCH v2 2/4] t4205: improve handling of ICONV prerequisite

In t4205 we have a bunch of tests that depend on the iconv prereq. This is for most of the part because we format commit messages that have been encoded in an encoding different than UTF-8.

Those tests fall into two classes though:
  - One class of tests outputs the data as-is without reencoding.
  - One class of tests outputs the data with "i18n.logOutputEncoding" to
    reencode it.

Curiously enough, both of these classes are marked with the ICONV prereq, even though one might expect that the first class wouldn't need the prereq. This is because we unconditionally use ISO-8859-1 encoding for the initial commit message, and thus we depend on converting to UTF-8 indeed.

This creates another problem though: when the iconv(1) executable does not exist the test setup fails, even in the case where the ICONV prereq has not been set.

Fix these issues by making the test encoding conditional on ICONV: if it's available we use ISO-8859-1, otherwise we use UTF-8. This fixes the test setup on platforms without iconv(1), and it allows us to drop the ICONV prereq from a bunch of tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4205-log-pretty-formats.sh | 50 ++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Show changes to t/t4205-log-pretty-formats.sh +28 −22
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 8f2ba98963..3865f6abc7 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -9,7 +9,12 @@ test_description='Test pretty formats'
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+if test_have_prereq ICONV
+then
+	test_encoding="ISO8859-1"
+else
+	test_encoding="UTF-8"
+fi
 
 sample_utf8_part=$(printf "f\303\244ng")
 
@@ -18,7 +23,7 @@ commit_msg () {
 	# (translated with Google Translate),
 	# encoded in UTF-8, used as a commit log message below.
 	msg="initial. an${sample_utf8_part}lich\n"
-	if test -n "$1"
+	if test -n "$1" && test "$1" != "UTF-8"
 	then
 		printf "$msg" | iconv -f utf-8 -t "$1"
 	else
@@ -113,19 +118,19 @@ test_expect_success 'alias loop' '
 	test_must_fail git log --pretty=test-foo
 '
 
-test_expect_success ICONV 'NUL separation' '
+test_expect_success 'NUL separation' '
 	printf "add bar\0$(commit_msg)" >expected &&
 	git log -z --pretty="format:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL termination' '
+test_expect_success 'NUL termination' '
 	printf "add bar\0$(commit_msg)\0" >expected &&
 	git log -z --pretty="tformat:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL separation with --stat' '
+test_expect_success 'NUL separation with --stat' '
 	stat0_part=$(git diff --stat HEAD^ HEAD) &&
 	stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -180,7 +185,7 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success ICONV 'left alignment formatting' '
+test_expect_success 'left alignment formatting' '
 	git log --pretty="tformat:%<(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	message two                            Z
@@ -202,7 +207,7 @@ test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %<|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -213,7 +218,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -235,7 +240,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column. i18n.log
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with no padding' '
+test_expect_success 'left alignment formatting with no padding' '
 	git log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -246,7 +251,7 @@ test_expect_success ICONV 'left alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with no padding. i18n.logOutputEncoding' '
 	git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
 	message two
@@ -257,7 +262,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with trunc' '
+test_expect_success 'left alignment formatting with trunc' '
 	git log --pretty="tformat:%<(10,trunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	message ..
@@ -279,7 +284,7 @@ test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputE
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with ltrunc' '
+test_expect_success 'left alignment formatting with ltrunc' '
 	git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	..sage two
@@ -301,7 +306,7 @@ test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with mtrunc' '
+test_expect_success 'left alignment formatting with mtrunc' '
 	git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	mess.. two
@@ -323,7 +328,7 @@ test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting' '
+test_expect_success 'right alignment formatting' '
 	git log --pretty="tformat:%>(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z                            message two
@@ -345,7 +350,7 @@ test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %>|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -356,7 +361,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -391,7 +396,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column with --g
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding' '
+test_expect_success 'right alignment formatting with no padding' '
 	git log --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -402,7 +407,7 @@ test_expect_success ICONV 'right alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
+test_expect_success 'right alignment formatting with no padding and with --graph' '
 	git log --graph --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	* message two
@@ -424,7 +429,7 @@ test_expect_success ICONV 'right alignment formatting with no padding. i18n.logO
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting' '
+test_expect_success 'center alignment formatting' '
 	git log --pretty="tformat:%><(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z             message two              Z
@@ -445,7 +450,8 @@ test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding'
 	EOF
 	test_cmp expected actual
 '
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+
+test_expect_success 'center alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %><|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -456,7 +462,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+test_expect_success 'center alignment formatting at the nth column' '
 	COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -478,7 +484,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column. i18n.l
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting with no padding' '
+test_expect_success 'center alignment formatting with no padding' '
 	git log --pretty="tformat:%><(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
-- 
2.53.0.352.gd1286b26eb.dirty
Patrick Steinhardt· Feb 17, 2026, 13:58 UTC · re: Patrick Steinhardt · lore

[PATCH v2 3/4] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error" to ensure that error messages are proprely forwarded. This URL executes the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1) executable to reencode the message.

This executable may not exist on platforms, which will make the tests fail. Guard them with the ICONV prereq to fix such failures.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t5550-http-fetch-dumb.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Show changes to t/t5550-http-fetch-dumb.sh +10 −10
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index ed0ad66fad..55102e702c 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
 '
 
 test_expect_success 'did not use upload-pack service' '
-	! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
+	! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
 '
 
-test_expect_success 'git client shows text/plain errors' '
+test_expect_success ICONV 'git client shows text/plain errors' '
 	test_must_fail git clone "$HTTPD_URL/error/text" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client does not show html errors' '
+test_expect_success ICONV 'git client does not show html errors' '
 	test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
-	! grep "this is the error message" stderr
+	! test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client shows text/plain with a charset' '
+test_expect_success ICONV 'git client shows text/plain with a charset' '
 	test_must_fail git clone "$HTTPD_URL/error/charset" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'http error messages are reencoded' '
 	test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
 	test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 check_language () {
@@ -406,7 +406,7 @@ ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
 
 test_expect_success 'git client send an empty Accept-Language' '
 	GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
-	! grep "^=> Send header: Accept-Language:" stderr
+	! test_grep "^=> Send header: Accept-Language:" stderr
 '
 
 test_expect_success 'remote-http complains cleanly about malformed urls' '
-- 
2.53.0.352.gd1286b26eb.dirty
Patrick Steinhardt· Feb 17, 2026, 13:58 UTC · re: Patrick Steinhardt · lore

[PATCH v2 4/4] t6006: don't use iconv(1) without ICONV prereq

Two tests in t6006 depend on the iconv(1) prerequisite to reencode a commit message. This executable may not even exist though in case the prereq is not set, which will cause the tests to fail.

Fix this by using UTF-8 instead when the prereq is not set.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t6006-rev-list-format.sh | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
Show changes to t/t6006-rev-list-format.sh +21 −8
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index eb93d68d7d..581984467d 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -378,15 +378,23 @@ test_expect_success 'rev-list %C(auto,...) respects --color' '
 	test_cmp expect actual
 '
 
-iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
-Test printing of complex bodies
+test_expect_success 'setup complex body' '
+	message=$(cat <<-EOF
+	Test printing of complex bodies
 
-This commit message is much longer than the others,
-and it will be encoded in $test_encoding. We should therefore
-include an ISO8859 character: ¡bueno!
-EOF
+	This commit message is much longer than the others,
+	and it will be encoded in $test_encoding. We should therefore
+	include an ISO8859 character: ¡bueno!
+	EOF
+	) &&
+
+	if test_have_prereq ICONV
+	then
+		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
+	else
+		echo "$message" >commit-msg
+	fi &&
 
-test_expect_success 'setup complex body' '
 	git config i18n.commitencoding $test_encoding &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
@@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
 	commit $head2
 	commit $head1
 	EOF
-	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	if test_have_prereq ICONV
+	then
+		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	else
+		cp expected.utf-8 expected.ISO8859-1
+	fi
 '
 
 test_format complex-body %b <expected.ISO8859-1
-- 
2.53.0.352.gd1286b26eb.dirty
Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 0/5] Fix tests with missing iconv(1) executable

Hi,

I recently noticed that the MSVC-based tests in GitLab CI started to fail. The root cause is that the iconv(1) executable cannot be found on this platform anymore. This isn't entirely surprising: we depend on the Git for Windows environment to provide necessary shell tools, and that environment of course is not a fully fledged MSYS2 installation.

In any case, this patch series fixes those issues by building on top of the ICONV prerequisite. If the prereq isn't found, then we also don't assume that the iconv(1) executable exists.

An alternative strategy would be to introduce a new ICONV_EXECUTABLE prereq. But given that Git doesn't perform any kind of reencoding itself in case the ICONV support isn't built into it I found it to not be worth the additional hassle.

In any case, this patch series causes the MSVC jobs to pass again on GitLab CI.

Changes in v3:
  - Split out the changes for the ICONV prerequisite into a standalone
    commit.
  - Link to v2: https://lore.kernel.org/r/20260217-b4-pks-ci-msvc-iconv-fixes-v2-0-25491bc8dbf8@pks.im
Changes in v2:
  - Extend the ICONV prerequisite to cover the new semantics and add a
    NEEDSWORK comment.
  - Mention the upstream issue in Git for Windows.
  - Link to v1: https://lore.kernel.org/r/20260209-b4-pks-ci-msvc-iconv-fixes-v1-0-1e3167cd8828@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (5):
      t: don't set ICONV prereq when iconv(1) is missing
      t40xx: don't use iconv(1) without ICONV prereq
      t4205: improve handling of ICONV prerequisite
      t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
      t6006: don't use iconv(1) without ICONV prereq
 t/t4041-diff-submodule-option.sh             |  8 +++--
 t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
 t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
 t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
 t/t5550-http-fetch-dumb.sh                   | 20 +++++------
 t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
 t/test-lib.sh                                | 12 ++++++-
 7 files changed, 88 insertions(+), 47 deletions(-)
Range-diff versus v2:
-:  ---------- > 1:  74b9ab2ca1 t: don't set ICONV prereq when iconv(1) is missing
1:  50bcd30389 ! 2:  f0461ca7cb t4xxx: don't use iconv(1) without ICONV prereq
    @@ Metadata
     Author: Patrick Steinhardt <ps@pks.im>
     
      ## Commit message ##
    -    t4xxx: don't use iconv(1) without ICONV prereq
    +    t40xx: don't use iconv(1) without ICONV prereq
     
    -    We've got a couple of tests that all use the iconv(1) executable to
    -    convert the encoding of a commit message. All of these tests are
    -    prepared to handle a missing ICONV prereq, in which case they will
    -    simply use UTF-8 encoding.
    +    We've got a couple of tests related to diffs in t40xx that use the
    +    iconv(1) executable to convert the encoding of a commit message. All of
    +    these tests are prepared to handle a missing ICONV prereq, in which case
    +    they will simply use UTF-8 encoding.
     
         But even if the ICONV prerequisite has failed we try to use the iconv(1)
    -    executable. But it's not a safe to assume that the executable exists in
    -    that case. And besides that, it's also unnecessary to use iconv(1) in
    -    the first place, as we would only use it to convert from UTF-8 to UTF-8,
    -    which should be equivalent to a no-op.
    -
    -    In fact, Git for Windows has recently (unintentionally) shipped a change
    -    where the iconv(1) binary is not getting installed anymore [1]. And as
    -    we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has
    -    exposed the issue. The missing iconv(1) binary is considered a bug that
    -    will be fixed in Git for Windows, but regardless of that it makes sense
    -    to not assume the binary to always exist.
    +    executable, even though it's not safe to assume that the executable
    +    exists in that case. And besides that, it's also unnecessary to use
    +    iconv(1) in the first place, as we would only use it to convert from
    +    UTF-8 to UTF-8, which should be equivalent to a no-op.
     
         Fix the issue and skip the call to iconv(1) in case the prerequisite is
         not set. This makes tests work on systems that don't have iconv at all.
    -    Extend the ICONV prerequisite to cover these new semantics so that we
    -    know to skip tests in case the iconv(1) binary doesn't exist.
    -
    -    [1]: https://github.com/git-for-windows/git/issues/6083
     
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
     
    @@ t/t4060-diff-submodule-option-diff-format.sh: add_file () {
      		done >/dev/null &&
      		git rev-parse --short --verify HEAD
      	)
    -
    - ## t/test-lib.sh ##
    -@@ t/test-lib.sh: esac
    - ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
    - test -z "$NO_CURL" && test_set_prereq LIBCURL
    - test -z "$NO_GITWEB" && test_set_prereq GITWEB
    --test -z "$NO_ICONV" && test_set_prereq ICONV
    - test -z "$NO_PERL" && test_set_prereq PERL
    - test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
    - test -z "$NO_PYTHON" && test_set_prereq PYTHON
    -@@ t/test-lib.sh: test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
    - test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
    - test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
    - 
    -+test_lazy_prereq ICONV '
    -+	# We require Git to be built with iconv support, and we require the
    -+	# iconv binary to exist.
    -+	#
    -+	# NEEDSWORK: We might eventually want to split this up into two
    -+	# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
    -+	# some tests only depend on either of these.
    -+	test -z "$NO_ICONV" &&
    -+	iconv -f utf8 -t utf8 </dev/null
    -+'
    -+
    - if test -z "$GIT_TEST_CHECK_CACHE_TREE"
    - then
    - 	GIT_TEST_CHECK_CACHE_TREE=true
2:  5b4e3270bc = 3:  cdbc1ca807 t4205: improve handling of ICONV prerequisite
3:  60dfbaaf17 = 4:  3c66466ba4 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
4:  b29618e071 = 5:  0306f9d1f8 t6006: don't use iconv(1) without ICONV prereq

--- base-commit: 3e0db84c88c57e70ac8be8c196dfa92c5d656fbc change-id: 20260209-b4-pks-ci-msvc-iconv-fixes-13de4801643f

Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 1/5] t: don't set ICONV prereq when iconv(1) is missing

We've got a couple of tests that exercise Git with different encodings, typically around commit messages. All of these tests depend on the ICONV prerequisite, which is set when Git was built with support for iconv.

Many of those tests also end up using the iconv(1) executable to reencode text. But while tests can rely on the fact that Git does have support for iconv, they cannot assume that the iconv(1) executable exists. The consequence is thus that tests will break in case Git is built with iconv, but the executable doesn't exist. In fact, some of the tests even use the iconv(1) executable unconditionally, regardless of whether or not the ICONV prerequisite is set.

Git for Windows has recently (unintentionally) shipped a change where the iconv(1) binary is not getting installed anymore [1]. And as we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has caused such tests to break. The missing iconv(1) binary is considered a bug that will be fixed in Git for Windows. But regardless of that it makes sense to not assume the binary to always exist so that our test suite passes on platforms that don't have iconv at all.

Extend the ICONV prerequisite so that we know to skip tests in case the iconv(1) binary doesn't exist. We'll adapt tests that are currently broken in subsequent commits.

[1]: https://github.com/git-for-windows/git/issues/6083
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/test-lib.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Show changes to t/test-lib.sh +11 −1
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fb76f7d11..67d15ae079 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1720,7 +1720,6 @@ esac
 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
 test -z "$NO_CURL" && test_set_prereq LIBCURL
 test -z "$NO_GITWEB" && test_set_prereq GITWEB
-test -z "$NO_ICONV" && test_set_prereq ICONV
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
@@ -1731,6 +1730,17 @@ test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
 test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
 test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
 
+test_lazy_prereq ICONV '
+	# We require Git to be built with iconv support, and we require the
+	# iconv binary to exist.
+	#
+	# NEEDSWORK: We might eventually want to split this up into two
+	# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
+	# some tests only depend on either of these.
+	test -z "$NO_ICONV" &&
+	iconv -f utf8 -t utf8 </dev/null
+'
+
 if test -z "$GIT_TEST_CHECK_CACHE_TREE"
 then
 	GIT_TEST_CHECK_CACHE_TREE=true
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 2/5] t40xx: don't use iconv(1) without ICONV prereq

We've got a couple of tests related to diffs in t40xx that use the iconv(1) executable to convert the encoding of a commit message. All of these tests are prepared to handle a missing ICONV prereq, in which case they will simply use UTF-8 encoding.

But even if the ICONV prerequisite has failed we try to use the iconv(1) executable, even though it's not safe to assume that the executable exists in that case. And besides that, it's also unnecessary to use iconv(1) in the first place, as we would only use it to convert from UTF-8 to UTF-8, which should be equivalent to a no-op.

Fix the issue and skip the call to iconv(1) in case the prerequisite is not set. This makes tests work on systems that don't have iconv at all.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4041-diff-submodule-option.sh             | 8 ++++++--
 t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
 t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)
Show changes to 3 files +18 −6

t/t4041-diff-submodule-option.sh, t/t4059-diff-submodule-not-initialized.sh, t/t4060-diff-submodule-option-diff-format.sh

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 4d4aa1650f..4dd4954260 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -37,8 +37,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 0fe81056d5..bb902ce94d 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index dbfeb7470b..d8f9213255 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 3/5] t4205: improve handling of ICONV prerequisite

In t4205 we have a bunch of tests that depend on the iconv prereq. This is for most of the part because we format commit messages that have been encoded in an encoding different than UTF-8.

Those tests fall into two classes though:
  - One class of tests outputs the data as-is without reencoding.
  - One class of tests outputs the data with "i18n.logOutputEncoding" to
    reencode it.

Curiously enough, both of these classes are marked with the ICONV prereq, even though one might expect that the first class wouldn't need the prereq. This is because we unconditionally use ISO-8859-1 encoding for the initial commit message, and thus we depend on converting to UTF-8 indeed.

This creates another problem though: when the iconv(1) executable does not exist the test setup fails, even in the case where the ICONV prereq has not been set.

Fix these issues by making the test encoding conditional on ICONV: if it's available we use ISO-8859-1, otherwise we use UTF-8. This fixes the test setup on platforms without iconv(1), and it allows us to drop the ICONV prereq from a bunch of tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4205-log-pretty-formats.sh | 50 ++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Show changes to t/t4205-log-pretty-formats.sh +28 −22
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 8f2ba98963..3865f6abc7 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -9,7 +9,12 @@ test_description='Test pretty formats'
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+if test_have_prereq ICONV
+then
+	test_encoding="ISO8859-1"
+else
+	test_encoding="UTF-8"
+fi
 
 sample_utf8_part=$(printf "f\303\244ng")
 
@@ -18,7 +23,7 @@ commit_msg () {
 	# (translated with Google Translate),
 	# encoded in UTF-8, used as a commit log message below.
 	msg="initial. an${sample_utf8_part}lich\n"
-	if test -n "$1"
+	if test -n "$1" && test "$1" != "UTF-8"
 	then
 		printf "$msg" | iconv -f utf-8 -t "$1"
 	else
@@ -113,19 +118,19 @@ test_expect_success 'alias loop' '
 	test_must_fail git log --pretty=test-foo
 '
 
-test_expect_success ICONV 'NUL separation' '
+test_expect_success 'NUL separation' '
 	printf "add bar\0$(commit_msg)" >expected &&
 	git log -z --pretty="format:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL termination' '
+test_expect_success 'NUL termination' '
 	printf "add bar\0$(commit_msg)\0" >expected &&
 	git log -z --pretty="tformat:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL separation with --stat' '
+test_expect_success 'NUL separation with --stat' '
 	stat0_part=$(git diff --stat HEAD^ HEAD) &&
 	stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -180,7 +185,7 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success ICONV 'left alignment formatting' '
+test_expect_success 'left alignment formatting' '
 	git log --pretty="tformat:%<(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	message two                            Z
@@ -202,7 +207,7 @@ test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %<|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -213,7 +218,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -235,7 +240,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column. i18n.log
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with no padding' '
+test_expect_success 'left alignment formatting with no padding' '
 	git log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -246,7 +251,7 @@ test_expect_success ICONV 'left alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with no padding. i18n.logOutputEncoding' '
 	git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
 	message two
@@ -257,7 +262,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with trunc' '
+test_expect_success 'left alignment formatting with trunc' '
 	git log --pretty="tformat:%<(10,trunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	message ..
@@ -279,7 +284,7 @@ test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputE
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with ltrunc' '
+test_expect_success 'left alignment formatting with ltrunc' '
 	git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	..sage two
@@ -301,7 +306,7 @@ test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with mtrunc' '
+test_expect_success 'left alignment formatting with mtrunc' '
 	git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	mess.. two
@@ -323,7 +328,7 @@ test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting' '
+test_expect_success 'right alignment formatting' '
 	git log --pretty="tformat:%>(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z                            message two
@@ -345,7 +350,7 @@ test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %>|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -356,7 +361,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -391,7 +396,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column with --g
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding' '
+test_expect_success 'right alignment formatting with no padding' '
 	git log --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -402,7 +407,7 @@ test_expect_success ICONV 'right alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
+test_expect_success 'right alignment formatting with no padding and with --graph' '
 	git log --graph --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	* message two
@@ -424,7 +429,7 @@ test_expect_success ICONV 'right alignment formatting with no padding. i18n.logO
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting' '
+test_expect_success 'center alignment formatting' '
 	git log --pretty="tformat:%><(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z             message two              Z
@@ -445,7 +450,8 @@ test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding'
 	EOF
 	test_cmp expected actual
 '
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+
+test_expect_success 'center alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %><|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -456,7 +462,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+test_expect_success 'center alignment formatting at the nth column' '
 	COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -478,7 +484,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column. i18n.l
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting with no padding' '
+test_expect_success 'center alignment formatting with no padding' '
 	git log --pretty="tformat:%><(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 4/5] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error" to ensure that error messages are proprely forwarded. This URL executes the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1) executable to reencode the message.

This executable may not exist on platforms, which will make the tests fail. Guard them with the ICONV prereq to fix such failures.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t5550-http-fetch-dumb.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Show changes to t/t5550-http-fetch-dumb.sh +10 −10
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index ed0ad66fad..55102e702c 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
 '
 
 test_expect_success 'did not use upload-pack service' '
-	! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
+	! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
 '
 
-test_expect_success 'git client shows text/plain errors' '
+test_expect_success ICONV 'git client shows text/plain errors' '
 	test_must_fail git clone "$HTTPD_URL/error/text" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client does not show html errors' '
+test_expect_success ICONV 'git client does not show html errors' '
 	test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
-	! grep "this is the error message" stderr
+	! test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client shows text/plain with a charset' '
+test_expect_success ICONV 'git client shows text/plain with a charset' '
 	test_must_fail git clone "$HTTPD_URL/error/charset" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'http error messages are reencoded' '
 	test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
 	test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 check_language () {
@@ -406,7 +406,7 @@ ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
 
 test_expect_success 'git client send an empty Accept-Language' '
 	GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
-	! grep "^=> Send header: Accept-Language:" stderr
+	! test_grep "^=> Send header: Accept-Language:" stderr
 '
 
 test_expect_success 'remote-http complains cleanly about malformed urls' '
-- 
2.53.0.414.gf7e9f6c205.dirty
Eric Sunshine· Feb 19, 2026, 23:49 UTC · re: Patrick Steinhardt · lore

Re: [PATCH v3 4/5] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

On Wed, Feb 18, 2026 at 4:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error"
> to ensure that error messages are proprely forwarded. This URL executes
s/proprely/properly/
Show 14 quoted lines
> the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1)
> executable to reencode the message.
>
> This executable may not exist on platforms, which will make the tests
> fail. Guard them with the ICONV prereq to fix such failures.
>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
> @@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
>  test_expect_success 'did not use upload-pack service' '
> -       ! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
> +       ! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
>  '
You want to be using `test_grep !` here rather than `! test_grep`, don't you?
Same comment applies to several other tests touched by this patch.
Patrick Steinhardt· Feb 20, 2026, 08:00 UTC · re: Eric Sunshine · lore

Re: [PATCH v3 4/5] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

On Thu, Feb 19, 2026 at 06:49:14PM -0500, Eric Sunshine wrote:
Show 24 quoted lines
> On Wed, Feb 18, 2026 at 4:17 AM Patrick Steinhardt <ps@pks.im> wrote:
> > We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error"
> > to ensure that error messages are proprely forwarded. This URL executes
> 
> s/proprely/properly/
> 
> > the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1)
> > executable to reencode the message.
> >
> > This executable may not exist on platforms, which will make the tests
> > fail. Guard them with the ICONV prereq to fix such failures.
> >
> > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > ---
> > diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
> > @@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
> >  test_expect_success 'did not use upload-pack service' '
> > -       ! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
> > +       ! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
> >  '
> 
> You want to be using `test_grep !` here rather than `! test_grep`, don't you?
> 
> Same comment applies to several other tests touched by this patch.

Oh, yeah, you're right of course. Will send another version to improve this. Thanks!

Patrick
Patrick Steinhardt· Feb 18, 2026, 04:38 UTC · re: Patrick Steinhardt · lore

[PATCH v3 5/5] t6006: don't use iconv(1) without ICONV prereq

Two tests in t6006 depend on the iconv(1) prerequisite to reencode a commit message. This executable may not even exist though in case the prereq is not set, which will cause the tests to fail.

Fix this by using UTF-8 instead when the prereq is not set.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t6006-rev-list-format.sh | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
Show changes to t/t6006-rev-list-format.sh +21 −8
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index eb93d68d7d..581984467d 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -378,15 +378,23 @@ test_expect_success 'rev-list %C(auto,...) respects --color' '
 	test_cmp expect actual
 '
 
-iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
-Test printing of complex bodies
+test_expect_success 'setup complex body' '
+	message=$(cat <<-EOF
+	Test printing of complex bodies
 
-This commit message is much longer than the others,
-and it will be encoded in $test_encoding. We should therefore
-include an ISO8859 character: ¡bueno!
-EOF
+	This commit message is much longer than the others,
+	and it will be encoded in $test_encoding. We should therefore
+	include an ISO8859 character: ¡bueno!
+	EOF
+	) &&
+
+	if test_have_prereq ICONV
+	then
+		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
+	else
+		echo "$message" >commit-msg
+	fi &&
 
-test_expect_success 'setup complex body' '
 	git config i18n.commitencoding $test_encoding &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
@@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
 	commit $head2
 	commit $head1
 	EOF
-	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	if test_have_prereq ICONV
+	then
+		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	else
+		cp expected.utf-8 expected.ISO8859-1
+	fi
 '
 
 test_format complex-body %b <expected.ISO8859-1
-- 
2.53.0.414.gf7e9f6c205.dirty
Junio C Hamano· Feb 18, 2026, 17:46 UTC · re: Patrick Steinhardt · lore

Re: [PATCH v3 5/5] t6006: don't use iconv(1) without ICONV prereq

Patrick Steinhardt <ps@pks.im> writes:
Show 5 quoted lines
> Two tests in t6006 depend on the iconv(1) prerequisite to reencode a
> commit message. This executable may not even exist though in case the
> prereq is not set, which will cause the tests to fail.
>
> Fix this by using UTF-8 instead when the prereq is not set.

The above makes perfect sense, but would the rest of the test involving this data need to be adjusted to expect utf-8 instead of $test_encoding when iconv is not available?

Show 15 quoted lines
> -iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
> -Test printing of complex bodies
> +test_expect_success 'setup complex body' '
> +	message=$(cat <<-EOF
> +	Test printing of complex bodies
>  
> -This commit message is much longer than the others,
> -and it will be encoded in $test_encoding. We should therefore
> -include an ISO8859 character: ¡bueno!
> -EOF
> +	This commit message is much longer than the others,
> +	and it will be encoded in $test_encoding. We should therefore
> +	include an ISO8859 character: ¡bueno!
> +	EOF
> +	) &&
Creative use of "cat" only to strip leading.   Otherwise,
	message="Test printing of ...
	...
	include an ISO8859 character: ¡bueno!"
would have sufficed ;-).
Show 6 quoted lines
> +	if test_have_prereq ICONV
> +	then
> +		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
> +	else
> +		echo "$message" >commit-msg
> +	fi &&

So we have the message in the file encoded in either utf-8 or the target encoding.

> -test_expect_success 'setup complex body' '
>  	git config i18n.commitencoding $test_encoding &&

But we claim unconditionally $test_encoding is used in the commit object. This is OK because test_encoding is also set to UTF-8 in the IONV challenged environment. Cute.

Show 14 quoted lines
> @@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
>  	commit $head2
>  	commit $head1
>  	EOF
> -	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
> +	if test_have_prereq ICONV
> +	then
> +		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
> +	else
> +		cp expected.utf-8 expected.ISO8859-1
> +	fi
>  '
>  
>  test_format complex-body %b <expected.ISO8859-1

And this is the same idea. It is confiusing that the data has nothing to do with Latin-1 when iconv is not in use, but things will even out. Nice.

Christian Couder· Feb 18, 2026, 06:46 UTC · re: Patrick Steinhardt · lore

Re: [PATCH v3 0/5] Fix tests with missing iconv(1) executable

(Replying with git send-email as I didn't received your email in my Gmail box.) 
Show 7 quoted lines
> In any case, this patch series causes the MSVC jobs to pass again on
> GitLab CI.
>
> Changes in v3:
>  - Split out the changes for the ICONV prerequisite into a standalone
>    commit.
>  - Link to v2: https://lore.kernel.org/r/20260217-b4-pks-ci-msvc-iconv-fixes-v2-0-25491bc8dbf8@pks.im
Thanks. I think it's better with the ICONV prerequisite changes in their own commit.
The series looks ready to me now.
Patrick Steinhardt· Feb 18, 2026, 07:09 UTC · re: Christian Couder · lore

Re: [PATCH v3 0/5] Fix tests with missing iconv(1) executable

On Wed, Feb 18, 2026 at 07:46:13AM +0100, Christian Couder wrote:
Show 13 quoted lines
> (Replying with git send-email as I didn't received your email in my Gmail box.) 
> 
> > In any case, this patch series causes the MSVC jobs to pass again on
> > GitLab CI.
> >
> > Changes in v3:
> >  - Split out the changes for the ICONV prerequisite into a standalone
> >    commit.
> >  - Link to v2: https://lore.kernel.org/r/20260217-b4-pks-ci-msvc-iconv-fixes-v2-0-25491bc8dbf8@pks.im
> 
> Thanks. I think it's better with the ICONV prerequisite changes in their own commit.
> 
> The series looks ready to me now.
Thanks!
Patrick
Patrick Steinhardt· Feb 20, 2026, 08:25 UTC · re: Patrick Steinhardt · lore

[PATCH v4 0/5] Fix tests with missing iconv(1) executable

Hi,

I recently noticed that the MSVC-based tests in GitLab CI started to fail. The root cause is that the iconv(1) executable cannot be found on this platform anymore. This isn't entirely surprising: we depend on the Git for Windows environment to provide necessary shell tools, and that environment of course is not a fully fledged MSYS2 installation.

In any case, this patch series fixes those issues by building on top of the ICONV prerequisite. If the prereq isn't found, then we also don't assume that the iconv(1) executable exists.

An alternative strategy would be to introduce a new ICONV_EXECUTABLE prereq. But given that Git doesn't perform any kind of reencoding itself in case the ICONV support isn't built into it I found it to not be worth the additional hassle.

In any case, this patch series causes the MSVC jobs to pass again on GitLab CI.

Changes in v4:
  - Use `test_grep !` instead of `! test_grep`.
  - Another commit message typo fix.
  - Link to v3: https://lore.kernel.org/r/20260218-b4-pks-ci-msvc-iconv-fixes-v3-0-08c1ff3ffc9a@pks.im
Changes in v3:
  - Split out the changes for the ICONV prerequisite into a standalone
    commit.
  - Link to v2: https://lore.kernel.org/r/20260217-b4-pks-ci-msvc-iconv-fixes-v2-0-25491bc8dbf8@pks.im
Changes in v2:
  - Extend the ICONV prerequisite to cover the new semantics and add a
    NEEDSWORK comment.
  - Mention the upstream issue in Git for Windows.
  - Link to v1: https://lore.kernel.org/r/20260209-b4-pks-ci-msvc-iconv-fixes-v1-0-1e3167cd8828@pks.im
Thanks!
Patrick
---
Patrick Steinhardt (5):
      t: don't set ICONV prereq when iconv(1) is missing
      t40xx: don't use iconv(1) without ICONV prereq
      t4205: improve handling of ICONV prerequisite
      t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
      t6006: don't use iconv(1) without ICONV prereq
 t/t4041-diff-submodule-option.sh             |  8 +++--
 t/t4059-diff-submodule-not-initialized.sh    |  8 +++--
 t/t4060-diff-submodule-option-diff-format.sh |  8 +++--
 t/t4205-log-pretty-formats.sh                | 50 ++++++++++++++++------------
 t/t5550-http-fetch-dumb.sh                   | 20 +++++------
 t/t6006-rev-list-format.sh                   | 29 +++++++++++-----
 t/test-lib.sh                                | 12 ++++++-
 7 files changed, 88 insertions(+), 47 deletions(-)
Range-diff versus v3:
1:  3cfc78f873 = 1:  ac36dae86b t: don't set ICONV prereq when iconv(1) is missing
2:  768d0c8de1 = 2:  4b461caa9b t40xx: don't use iconv(1) without ICONV prereq
3:  b552d77cf4 = 3:  ad9278cab4 t4205: improve handling of ICONV prerequisite
4:  7f35641968 ! 4:  863488c534 t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
    @@ Commit message
         t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"
     
         We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error"
    -    to ensure that error messages are proprely forwarded. This URL executes
    +    to ensure that error messages are properly forwarded. This URL executes
         the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1)
         executable to reencode the message.
     
    @@ t/t5550-http-fetch-dumb.sh: test_expect_success 'fetch can handle previously-fet
      
      test_expect_success 'did not use upload-pack service' '
     -	! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
    -+	! test_grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
    ++	test_grep ! "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
      '
      
     -test_expect_success 'git client shows text/plain errors' '
    @@ t/t5550-http-fetch-dumb.sh: test_expect_success 'fetch can handle previously-fet
     +test_expect_success ICONV 'git client does not show html errors' '
      	test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
     -	! grep "this is the error message" stderr
    -+	! test_grep "this is the error message" stderr
    ++	test_grep ! "this is the error message" stderr
      '
      
     -test_expect_success 'git client shows text/plain with a charset' '
    @@ t/t5550-http-fetch-dumb.sh: ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.9
      test_expect_success 'git client send an empty Accept-Language' '
      	GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
     -	! grep "^=> Send header: Accept-Language:" stderr
    -+	! test_grep "^=> Send header: Accept-Language:" stderr
    ++	test_grep ! "^=> Send header: Accept-Language:" stderr
      '
      
      test_expect_success 'remote-http complains cleanly about malformed urls' '
5:  c8e69ff135 = 5:  58533d4b58 t6006: don't use iconv(1) without ICONV prereq

--- base-commit: 3e0db84c88c57e70ac8be8c196dfa92c5d656fbc change-id: 20260209-b4-pks-ci-msvc-iconv-fixes-13de4801643f

Patrick Steinhardt· Feb 20, 2026, 08:25 UTC · re: Patrick Steinhardt · lore

[PATCH v4 1/5] t: don't set ICONV prereq when iconv(1) is missing

We've got a couple of tests that exercise Git with different encodings, typically around commit messages. All of these tests depend on the ICONV prerequisite, which is set when Git was built with support for iconv.

Many of those tests also end up using the iconv(1) executable to reencode text. But while tests can rely on the fact that Git does have support for iconv, they cannot assume that the iconv(1) executable exists. The consequence is thus that tests will break in case Git is built with iconv, but the executable doesn't exist. In fact, some of the tests even use the iconv(1) executable unconditionally, regardless of whether or not the ICONV prerequisite is set.

Git for Windows has recently (unintentionally) shipped a change where the iconv(1) binary is not getting installed anymore [1]. And as we use Git for Windows directly in MSVC+Meson jobs in GitLab CI this has caused such tests to break. The missing iconv(1) binary is considered a bug that will be fixed in Git for Windows. But regardless of that it makes sense to not assume the binary to always exist so that our test suite passes on platforms that don't have iconv at all.

Extend the ICONV prerequisite so that we know to skip tests in case the iconv(1) binary doesn't exist. We'll adapt tests that are currently broken in subsequent commits.

[1]: https://github.com/git-for-windows/git/issues/6083
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/test-lib.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
Show changes to t/test-lib.sh +11 −1
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fb76f7d11..67d15ae079 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1720,7 +1720,6 @@ esac
 ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1
 test -z "$NO_CURL" && test_set_prereq LIBCURL
 test -z "$NO_GITWEB" && test_set_prereq GITWEB
-test -z "$NO_ICONV" && test_set_prereq ICONV
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PTHREADS" && test_set_prereq PTHREADS
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
@@ -1731,6 +1730,17 @@ test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
 test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
 test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
 
+test_lazy_prereq ICONV '
+	# We require Git to be built with iconv support, and we require the
+	# iconv binary to exist.
+	#
+	# NEEDSWORK: We might eventually want to split this up into two
+	# prerequisites: one for NO_ICONV, and one for the iconv(1) binary, as
+	# some tests only depend on either of these.
+	test -z "$NO_ICONV" &&
+	iconv -f utf8 -t utf8 </dev/null
+'
+
 if test -z "$GIT_TEST_CHECK_CACHE_TREE"
 then
 	GIT_TEST_CHECK_CACHE_TREE=true
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 20, 2026, 08:26 UTC · re: Patrick Steinhardt · lore

[PATCH v4 2/5] t40xx: don't use iconv(1) without ICONV prereq

We've got a couple of tests related to diffs in t40xx that use the iconv(1) executable to convert the encoding of a commit message. All of these tests are prepared to handle a missing ICONV prereq, in which case they will simply use UTF-8 encoding.

But even if the ICONV prerequisite has failed we try to use the iconv(1) executable, even though it's not safe to assume that the executable exists in that case. And besides that, it's also unnecessary to use iconv(1) in the first place, as we would only use it to convert from UTF-8 to UTF-8, which should be equivalent to a no-op.

Fix the issue and skip the call to iconv(1) in case the prerequisite is not set. This makes tests work on systems that don't have iconv at all.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4041-diff-submodule-option.sh             | 8 ++++++--
 t/t4059-diff-submodule-not-initialized.sh    | 8 ++++++--
 t/t4060-diff-submodule-option-diff-format.sh | 8 ++++++--
 3 files changed, 18 insertions(+), 6 deletions(-)
Show changes to 3 files +18 −6

t/t4041-diff-submodule-option.sh, t/t4059-diff-submodule-not-initialized.sh, t/t4060-diff-submodule-option-diff-format.sh

diff --git a/t/t4041-diff-submodule-option.sh b/t/t4041-diff-submodule-option.sh
index 4d4aa1650f..4dd4954260 100755
--- a/t/t4041-diff-submodule-option.sh
+++ b/t/t4041-diff-submodule-option.sh
@@ -37,8 +37,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4059-diff-submodule-not-initialized.sh b/t/t4059-diff-submodule-not-initialized.sh
index 0fe81056d5..bb902ce94d 100755
--- a/t/t4059-diff-submodule-not-initialized.sh
+++ b/t/t4059-diff-submodule-not-initialized.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index dbfeb7470b..d8f9213255 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -35,8 +35,12 @@ add_file () {
 			test_tick &&
 			# "git commit -m" would break MinGW, as Windows refuse to pass
 			# $test_encoding encoded parameter to git.
-			echo "Add $name ($added $name)" | iconv -f utf-8 -t $test_encoding |
-			git -c "i18n.commitEncoding=$test_encoding" commit -F -
+			message="Add $name ($added $name)" &&
+			if test_have_prereq ICONV
+			then
+				message=$(echo "$message" | iconv -f utf-8 -t $test_encoding)
+			fi &&
+			echo "$message" | git -c "i18n.commitEncoding=$test_encoding" commit -F -
 		done >/dev/null &&
 		git rev-parse --short --verify HEAD
 	)
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 20, 2026, 08:26 UTC · re: Patrick Steinhardt · lore

[PATCH v4 3/5] t4205: improve handling of ICONV prerequisite

In t4205 we have a bunch of tests that depend on the iconv prereq. This is for most of the part because we format commit messages that have been encoded in an encoding different than UTF-8.

Those tests fall into two classes though:
  - One class of tests outputs the data as-is without reencoding.
  - One class of tests outputs the data with "i18n.logOutputEncoding" to
    reencode it.

Curiously enough, both of these classes are marked with the ICONV prereq, even though one might expect that the first class wouldn't need the prereq. This is because we unconditionally use ISO-8859-1 encoding for the initial commit message, and thus we depend on converting to UTF-8 indeed.

This creates another problem though: when the iconv(1) executable does not exist the test setup fails, even in the case where the ICONV prereq has not been set.

Fix these issues by making the test encoding conditional on ICONV: if it's available we use ISO-8859-1, otherwise we use UTF-8. This fixes the test setup on platforms without iconv(1), and it allows us to drop the ICONV prereq from a bunch of tests.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t4205-log-pretty-formats.sh | 50 ++++++++++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 22 deletions(-)
Show changes to t/t4205-log-pretty-formats.sh +28 −22
diff --git a/t/t4205-log-pretty-formats.sh b/t/t4205-log-pretty-formats.sh
index 8f2ba98963..3865f6abc7 100755
--- a/t/t4205-log-pretty-formats.sh
+++ b/t/t4205-log-pretty-formats.sh
@@ -9,7 +9,12 @@ test_description='Test pretty formats'
 . ./test-lib.sh
 
 # Tested non-UTF-8 encoding
-test_encoding="ISO8859-1"
+if test_have_prereq ICONV
+then
+	test_encoding="ISO8859-1"
+else
+	test_encoding="UTF-8"
+fi
 
 sample_utf8_part=$(printf "f\303\244ng")
 
@@ -18,7 +23,7 @@ commit_msg () {
 	# (translated with Google Translate),
 	# encoded in UTF-8, used as a commit log message below.
 	msg="initial. an${sample_utf8_part}lich\n"
-	if test -n "$1"
+	if test -n "$1" && test "$1" != "UTF-8"
 	then
 		printf "$msg" | iconv -f utf-8 -t "$1"
 	else
@@ -113,19 +118,19 @@ test_expect_success 'alias loop' '
 	test_must_fail git log --pretty=test-foo
 '
 
-test_expect_success ICONV 'NUL separation' '
+test_expect_success 'NUL separation' '
 	printf "add bar\0$(commit_msg)" >expected &&
 	git log -z --pretty="format:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL termination' '
+test_expect_success 'NUL termination' '
 	printf "add bar\0$(commit_msg)\0" >expected &&
 	git log -z --pretty="tformat:%s" >actual &&
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'NUL separation with --stat' '
+test_expect_success 'NUL separation with --stat' '
 	stat0_part=$(git diff --stat HEAD^ HEAD) &&
 	stat1_part=$(git diff-tree --no-commit-id --stat --root HEAD^) &&
 	printf "add bar\n$stat0_part\n\0$(commit_msg)\n$stat1_part\n" >expected &&
@@ -180,7 +185,7 @@ test_expect_success 'setup more commits' '
 	head4=$(git rev-parse --verify --short HEAD~3)
 '
 
-test_expect_success ICONV 'left alignment formatting' '
+test_expect_success 'left alignment formatting' '
 	git log --pretty="tformat:%<(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	message two                            Z
@@ -202,7 +207,7 @@ test_expect_success ICONV 'left alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %<|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -213,7 +218,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting at the nth column' '
+test_expect_success 'left alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %<|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1 message two                    Z
@@ -235,7 +240,7 @@ test_expect_success ICONV 'left alignment formatting at the nth column. i18n.log
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with no padding' '
+test_expect_success 'left alignment formatting with no padding' '
 	git log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -246,7 +251,7 @@ test_expect_success ICONV 'left alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success 'left alignment formatting with no padding. i18n.logOutputEncoding' '
+test_expect_success ICONV 'left alignment formatting with no padding. i18n.logOutputEncoding' '
 	git -c i18n.logOutputEncoding=$test_encoding log --pretty="tformat:%<(1)%s" >actual &&
 	cat <<-EOF | iconv -f utf-8 -t $test_encoding >expected &&
 	message two
@@ -257,7 +262,7 @@ test_expect_success 'left alignment formatting with no padding. i18n.logOutputEn
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with trunc' '
+test_expect_success 'left alignment formatting with trunc' '
 	git log --pretty="tformat:%<(10,trunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	message ..
@@ -279,7 +284,7 @@ test_expect_success ICONV 'left alignment formatting with trunc. i18n.logOutputE
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with ltrunc' '
+test_expect_success 'left alignment formatting with ltrunc' '
 	git log --pretty="tformat:%<(10,ltrunc)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	..sage two
@@ -301,7 +306,7 @@ test_expect_success ICONV 'left alignment formatting with ltrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'left alignment formatting with mtrunc' '
+test_expect_success 'left alignment formatting with mtrunc' '
 	git log --pretty="tformat:%<(10,mtrunc)%s" >actual &&
 	qz_to_tab_space <<-\EOF >expected &&
 	mess.. two
@@ -323,7 +328,7 @@ test_expect_success ICONV 'left alignment formatting with mtrunc. i18n.logOutput
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting' '
+test_expect_success 'right alignment formatting' '
 	git log --pretty="tformat:%>(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z                            message two
@@ -345,7 +350,7 @@ test_expect_success ICONV 'right alignment formatting. i18n.logOutputEncoding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %>|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -356,7 +361,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting at the nth column' '
+test_expect_success 'right alignment formatting at the nth column' '
 	COLUMNS=50 git log --pretty="tformat:%h %>|(-10)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1                      message two
@@ -391,7 +396,7 @@ test_expect_success ICONV 'right alignment formatting at the nth column with --g
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding' '
+test_expect_success 'right alignment formatting with no padding' '
 	git log --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
@@ -402,7 +407,7 @@ test_expect_success ICONV 'right alignment formatting with no padding' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'right alignment formatting with no padding and with --graph' '
+test_expect_success 'right alignment formatting with no padding and with --graph' '
 	git log --graph --pretty="tformat:%>(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	* message two
@@ -424,7 +429,7 @@ test_expect_success ICONV 'right alignment formatting with no padding. i18n.logO
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting' '
+test_expect_success 'center alignment formatting' '
 	git log --pretty="tformat:%><(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	Z             message two              Z
@@ -445,7 +450,8 @@ test_expect_success ICONV 'center alignment formatting. i18n.logOutputEncoding'
 	EOF
 	test_cmp expected actual
 '
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+
+test_expect_success 'center alignment formatting at the nth column' '
 	git log --pretty="tformat:%h %><|(40)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -456,7 +462,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column' '
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting at the nth column' '
+test_expect_success 'center alignment formatting at the nth column' '
 	COLUMNS=70 git log --pretty="tformat:%h %><|(-30)%s" >actual &&
 	qz_to_tab_space <<-EOF >expected &&
 	$head1           message two          Z
@@ -478,7 +484,7 @@ test_expect_success ICONV 'center alignment formatting at the nth column. i18n.l
 	test_cmp expected actual
 '
 
-test_expect_success ICONV 'center alignment formatting with no padding' '
+test_expect_success 'center alignment formatting with no padding' '
 	git log --pretty="tformat:%><(1)%s" >actual &&
 	cat <<-EOF >expected &&
 	message two
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 20, 2026, 08:26 UTC · re: Patrick Steinhardt · lore

[PATCH v4 4/5] t5550: add ICONV prereq to tests that use "$HTTPD_URL/error"

We've got a bunch of tests in t5550 that connect to "$HTTPD_URL/error" to ensure that error messages are properly forwarded. This URL executes the "t/lib-httpd/error.sh" script, which in turn depends on the iconv(1) executable to reencode the message.

This executable may not exist on platforms, which will make the tests fail. Guard them with the ICONV prereq to fix such failures.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t5550-http-fetch-dumb.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Show changes to t/t5550-http-fetch-dumb.sh +10 −10
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index ed0ad66fad..05c34db780 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -339,32 +339,32 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
 '
 
 test_expect_success 'did not use upload-pack service' '
-	! grep "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
+	test_grep ! "/git-upload-pack" "$HTTPD_ROOT_PATH/access.log"
 '
 
-test_expect_success 'git client shows text/plain errors' '
+test_expect_success ICONV 'git client shows text/plain errors' '
 	test_must_fail git clone "$HTTPD_URL/error/text" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
-test_expect_success 'git client does not show html errors' '
+test_expect_success ICONV 'git client does not show html errors' '
 	test_must_fail git clone "$HTTPD_URL/error/html" 2>stderr &&
-	! grep "this is the error message" stderr
+	test_grep ! "this is the error message" stderr
 '
 
-test_expect_success 'git client shows text/plain with a charset' '
+test_expect_success ICONV 'git client shows text/plain with a charset' '
 	test_must_fail git clone "$HTTPD_URL/error/charset" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'http error messages are reencoded' '
 	test_must_fail git clone "$HTTPD_URL/error/utf16" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 test_expect_success ICONV 'reencoding is robust to whitespace oddities' '
 	test_must_fail git clone "$HTTPD_URL/error/odd-spacing" 2>stderr &&
-	grep "this is the error message" stderr
+	test_grep "this is the error message" stderr
 '
 
 check_language () {
@@ -406,7 +406,7 @@ ja;q=0.95, zh;q=0.94, sv;q=0.93, pt;q=0.92, nb;q=0.91, *;q=0.90" \
 
 test_expect_success 'git client send an empty Accept-Language' '
 	GIT_TRACE_CURL=true LANGUAGE= git ls-remote "$HTTPD_URL/dumb/repo.git" 2>stderr &&
-	! grep "^=> Send header: Accept-Language:" stderr
+	test_grep ! "^=> Send header: Accept-Language:" stderr
 '
 
 test_expect_success 'remote-http complains cleanly about malformed urls' '
-- 
2.53.0.414.gf7e9f6c205.dirty
Patrick Steinhardt· Feb 20, 2026, 08:26 UTC · re: Patrick Steinhardt · lore

[PATCH v4 5/5] t6006: don't use iconv(1) without ICONV prereq

Two tests in t6006 depend on the iconv(1) prerequisite to reencode a commit message. This executable may not even exist though in case the prereq is not set, which will cause the tests to fail.

Fix this by using UTF-8 instead when the prereq is not set.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t6006-rev-list-format.sh | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)
Show changes to t/t6006-rev-list-format.sh +21 −8
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index eb93d68d7d..581984467d 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -378,15 +378,23 @@ test_expect_success 'rev-list %C(auto,...) respects --color' '
 	test_cmp expect actual
 '
 
-iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
-Test printing of complex bodies
+test_expect_success 'setup complex body' '
+	message=$(cat <<-EOF
+	Test printing of complex bodies
 
-This commit message is much longer than the others,
-and it will be encoded in $test_encoding. We should therefore
-include an ISO8859 character: ¡bueno!
-EOF
+	This commit message is much longer than the others,
+	and it will be encoded in $test_encoding. We should therefore
+	include an ISO8859 character: ¡bueno!
+	EOF
+	) &&
+
+	if test_have_prereq ICONV
+	then
+		echo "$message" | iconv -f utf-8 -t $test_encoding >commit-msg
+	else
+		echo "$message" >commit-msg
+	fi &&
 
-test_expect_success 'setup complex body' '
 	git config i18n.commitencoding $test_encoding &&
 	echo change2 >foo && git commit -a -F commit-msg &&
 	head3=$(git rev-parse --verify HEAD) &&
@@ -448,7 +456,12 @@ test_expect_success 'setup expected messages (for test %b)' '
 	commit $head2
 	commit $head1
 	EOF
-	iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	if test_have_prereq ICONV
+	then
+		iconv -f utf-8 -t $test_encoding expected.utf-8 >expected.ISO8859-1
+	else
+		cp expected.utf-8 expected.ISO8859-1
+	fi
 '
 
 test_format complex-body %b <expected.ISO8859-1
-- 
2.53.0.414.gf7e9f6c205.dirty
Junio C Hamano· Feb 20, 2026, 15:53 UTC · re: Patrick Steinhardt · lore

Re: [PATCH v4 0/5] Fix tests with missing iconv(1) executable

Patrick Steinhardt <ps@pks.im> writes:
> Changes in v4:
>   - Use `test_grep !` instead of `! test_grep`.

I missed these when I looked at the previous round. Thanks for catching and fixing them.

← back to recent threads