On Thu, Sep 22, 2022 at 2:35 AM Jeff King <peff@xxxxxxxx> wrote: > On Thu, Sep 22, 2022 at 02:26:09AM -0400, Eric Sunshine wrote: > > I was thinking, in particular, about this snippet from t/test-lib.sh: > > > > # git sees Windows-style pwd > > pwd () { > > builtin pwd -W > > } > > > > If that's inherited by the subshell used in the test, then I suppose > > all is okay, though I think it would not be inherited. > > I think it's OK. $() is itself a subshell, and you can find many calls > to FOO=$(pwd) or similar. And in general, functions are inherited in > subshells: > > $ sh -c 'foo() { echo bar; }; (cd .. && foo)' > bar > > They'd have to be or many things in our test suite would break, since we > use test_must_fail, etc, inside subshells. Yep, thanks for the sanity dose. For some reason, my brain was off-kilter, thinking that it was running a shell afresh, not just using a subshell.