Subject: Re: [PATCH v2 12/12] t: detect errors outside of test cases

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 16 Apr 2026 12:46:14 +0200

On Thu, Apr 16, 2026 at 02:00:59AM -0400, Jeff King wrote:
> On Wed, Apr 15, 2026 at 03:06:45PM +0200, Patrick Steinhardt wrote:
> 
> > Improve the status quo by enabling the errexit option so that any such
> > unchecked failures will cause us to abort immediately.
> > 
> > Note that for now, we only enable this option for Bash 5 and newer. This
> > is because other shells have wildly different behaviour, and older
> > versions of Bash (especially on macOS) are buggy. The list of enabled
> > shells may be extended going forward.
> 
> OK, we know that this does not cause false positives because all of the
> tests should pass. It would be nice if we could verify that it catches
> bugs, too. Doing this:
> 
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index e4d32bb4d2..5521f21e64 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -980,4 +980,6 @@ test_expect_success 're-init reads matching includeIf.onbranch' '
>  	test_cmp expect err
>  '
>  
> +test_expect_foobar 'baz'
> +
>  test_done
> 
> will fail for me, but only if I specially ask to use bash, either
> manually or by setting TEST_SHELL_PATH (since /bin/sh is dash on
> Debian). Is there something in both GitHub and GitLab CI that will
> reliably use an acceptable version of bash?
> 
> I guess perhaps Windows, though I don't know what version is used there.
> But should we maybe set TEST_SHELL_PATH in at least one of the linux
> builds?

Our Fedora-based builds use Bash 5.3.0, so we at least have some test
coverage [1]. But I agree that it would make sense to maybe also make
one of our Ubuntu-based builds use Bash explicitly instead of Dash.

Patrick

[1]: https://gitlab.com/gitlab-org/git/-/jobs/13947942805