Re: [PATCH 1/2] t7900: adapt some tests to use a throwaway repository

Karthik Nayak <[email protected]>
Newsgroups org.kernel.vger.git
Message-ID <CAOLa=ZRXoqtYfDYhTatXZt9ojP2_5WrtJY7exR_TEPHZVqEE2A@mail.gmail.com>
Patrick Steinhardt <[email protected]> writes:

> On Wed, Aug 12, 2026 at 01:19:13AM -0700, Karthik Nayak wrote:
>> Patrick Steinhardt <[email protected]> writes:
>> > diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh
>> > index 4238569b68..6735a9e082 100755
>> > --- a/t/t7900-maintenance.sh
>> > +++ b/t/t7900-maintenance.sh
>> > @@ -67,41 +67,57 @@ test_expect_success 'run [--auto|--quiet] with gc strategy' '
> [snip]
>> >  test_expect_success 'maintenance.auto overrides gc.auto' '
>> > -	test_when_finished "rm -f trace" &&
>> > +	test_when_finished "rm -rf repo" &&
>> > +	git init repo &&
>> > +	(
>> > +		cd repo &&
>> >
>> > -	test_config maintenance.auto false &&
>> > -	test_config gc.auto 1 &&
>> > -	GIT_TRACE2_EVENT="$(pwd)/trace" git commit --quiet --allow-empty -m 1 &&
>> > -	test_subcommand ! git maintenance run --auto --quiet --detach <trace &&
>> > +		git config set maintenance.auto false &&
>> > +		git config set gc.auto 1 &&
>>
>> So we change from using `test_config` to `git config`, I assume this is
>> because earlier since we used a shared folder, we had to undo any config
>> changes made. Now that's no longer needed. Nit: This is okay, but
>> would've been nicer to call out.
>
> The issue with `test_config` is that it executes `test_when_finished`,
> and that function cannot run in subshells. So we have to use `git config
> set` instead, but because it's a throw-away repository it doesn't
> matter.
>
> Patrick

Right, that slipped my mind entirely.
signature.asc (application/pgp-signature, 690 B)
-----BEGIN PGP SIGNATURE-----

iQHKBAEBCgA0FiEEV85Mf2N1cQ/LZcYGPtWfJI5GjH8FAmp9s3gWHGthcnRoaWsu
MTg4QGdtYWlsLmNvbQAKCRA+1Z8kjkaMf7bMDACcxcx5MU08BSrMeTPeorJSljov
2WtpswBwwRX/dLXuZJoSSHRBi2XsjLgg/IjKWx8PdfzJz5VECNb5qwWe4hZL8M/F
vFzKufW9J0Vwg0LO0ebJUzp3Ksj0TUbkm/G3SfdOqVAPEOqD3rABChZViMogW5ad
kg3tvel3OHygwWiIAyi+g878Tl1M6MiEg8AyW8qMAqME+16qX3brQor6yDZLxMAz
R/QoUZq213I1pDhKTxESybzWoFCShNzMoMLhPmXMyvVgLMWVROj6LpZT1hyI79Kn
1lJA/bTUKJSnXqJLduSpcfhKy9uWaw39/7c9G2H2APYAMd+cHKWipRqAFauK4DEu
V55bODgwzqIWzjqmhxYXCWqHUdWGPDR3Cdtd5dzouA+VFfNRYoPY9P7NNjQaEjn7
4XdrCW0RxXV1XcIWgVPJCTrJRrmItTya5s7fTm4GPocN9XxfTF4uWDLV3cKDnaU+
+MRBa9k3IzDpbeX/0/GZkCB8/gY0oSklMshm4tU=
=Jua4
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.