From: D. Ben Knoble Date: Tue, 12 Aug 2025 16:40:57 GMT Subject: Re: [PATCH v3 3/4] t7005: sanitize test environment for subsequent tests Message-ID: In-Reply-To: On Mon, Aug 11, 2025 at 6:34 PM Eric Sunshine wrote: > > On Mon, Aug 11, 2025 at 6:17 PM D. Ben Knoble > wrote: > > Some of the editor tests manipulate the environment or config in ways > > that affect future tests, but those modifications are visible to future > > tests and create a footgun for them. > > > > Use test_config, subshells, single-command environment overrides, and > > test helpers to automatically undo environment and config modifications > > once finished. > > > > Signed-off-by: D. Ben Knoble > > --- > > diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh > > @@ -34,61 +34,57 @@ > > -TERM=dumb > > -export TERM > > test_expect_success 'dumb should error out when falling back on vi' ' > > - test_must_fail git commit --amend > > + TERM=dumb test_must_fail git commit --amend > > ' > > Don't use one-shot environment variable assignments when calling shell > functions. Instead, you can do this: > > test_env TERM=dumb test_must_fail git commit --amend > > or employ the standard assignment/export boilerplate: > > TERM=dumb && > export TERM && > test_must_fail git commit --amend > > References: > https://lore.kernel.org/git/20240727053509.34339-1-ericsunshine@charter.net/T/#u > https://lore.kernel.org/git/20180713055205.32351-1-sunshine@sunshineco.com/T/#u Yep ;) I had the latter, switched (see range-diff, I think), and then CI caught me. Why doesn't the local test run catch it, though?