From: Patrick Steinhardt Date: Mon, 03 Mar 2025 10:33:21 GMT Subject: Re: [BUG/WIP PATCH] unit-tests: use clean test environment Message-ID: In-Reply-To: On Fri, Feb 28, 2025 at 06:15:42AM -0800, Junio C Hamano wrote: > Patrick Steinhardt writes: > > I suspect that most environment variables shouldn't matter (for now), so > > overall the duplication may be acceptable: > > > > - We need to unset a couple of variables, but we can probably reuse > > logic `git rev-parse --local-env-vars`. > > > > - We need to ask Git to not read the configuration, which we can do by > > setting a couple of envvars. This should be manageable. > > "Provide a controlled environment where Git pretends this is the > $HOME and that is the $AUTHOR_NAME and so on" is much more > preferrable than "Tell it not to read", no? Maybe. I guess for unit tests it's a lot less clear cut as most of the tests won't depend on such a controlled environment. So sanitizing the environment would be a good enough first step for me, and if we see demand for making specific information available to lots of tests we could still start to expose those at a later point. Of course, if the author already wants to do both steps right now I won't complain :) Patrick