Subject: Re: [PATCH v2 2/2] t: use test_config whenever possible

From: Junio C Hamano <[email-masked]>
Date: Mon, 17 May 2021 15:55:55 +0900

Firmin Martin <[email-masked]> writes:

> fact, I suspect that you misread the diff, cf. the end of the email). 
> I copy here the full test with line number to make sure that we are in
> the same page.

The following is the original test before your patch, right?

>>  415 test_expect_success "'fetch.recurseSubmodules=on-demand' overrides global config" '
>>  416     (
>>  417         cd downstream &&
>>  418         git fetch --recurse-submodules
>>  419     ) &&
>>  420     add_upstream_commit &&
>>  421     git config --global fetch.recurseSubmodules false &&
>>  422     head1=$(git rev-parse --short HEAD) &&
>>  423     git add submodule &&
>>  424     git commit -m "new submodule" &&
>>  425     head2=$(git rev-parse --short HEAD) &&
>>  426     echo "From $pwd/." > expect.err.2 &&
>>  427     echo "   $head1..$head2  super      -> origin/super" >>expect.err.2 &&
>>  428     head -3 expect.err >> expect.err.2 &&
>>  429     (
>>  430         cd downstream &&
>>  431         git config fetch.recurseSubmodules on-demand &&
>>  432         git fetch >../actual.out 2>../actual.err

Here we run one "fetch" inside downstream, with a config specific to
the downstream repository; the expectation is that this on-demand
setting is honored, overriding the "global" setting that was set on
line 421.

>>  433     ) &&
>>  434     git config --global --unset fetch.recurseSubmodules &&

And then we discard the "global" setting.

>>  435     (
>>  436         cd downstream &&
>>  437         git config --unset fetch.recurseSubmodules

Oh, I thought I saw there was another fetch before this unset
between 436 and 437, that writes to the same actual.out and
actual.err.

> At this point, I have the feeling that you have misread the diff
> (do correct me If I'm wrong) and saw ...
>>  (
>>      cd downstream &&
>>      git config fetch.recurseSubmodules on-demand &&
>>      git fetch >../actual.out 2>../actual.err
>>  ) &&
>>  git config --global --unset fetch.recurseSubmodules &&
>>  (
>>      cd downstream &&
>>      git fetch >../actual.out 2>../actual.err
>>      git config --unset fetch.recurseSubmodules
>>  ) &&

Exactly.  Thanks and sorry for the noise.