From: Junio C Hamano Date: Thu, 15 Feb 2024 17:22:27 GMT Subject: Re: [PATCH] t/lib-credential: clean additional credential Message-ID: In-Reply-To: <20240215043900.GA2821179@coredump.intra.peff.net> Jeff King writes: > On Thu, Feb 15, 2024 at 01:03:56AM +0000, Bo Anderson via GitGitGadget wrote: > >> From: Bo Anderson >> >> 71201ab0e5 (t/lib-credential.sh: ensure credential helpers handle long >> headers, 2023-05-01) added a test which stores credentials with the host >> victim.example.com but this was never cleaned up, leaving residual data >> in the credential store after running the tests. >> >> Add a cleanup call for this credential to resolve this issue. > > Good catch. The patch looks obviously correct. > > I'm not surprised nobody noticed until now, as I expect it is pretty > rare for people to run t0303 against system helpers (it is not a problem > for t0301, etc, because they only touch the internal trash directory). > > I wonder if we might want something like this, as well, which can catch > leftovers: Sounds like a good hygiene ;-). > > diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh > index 716bf1af9f..4183154243 100755 > --- a/t/t0302-credential-store.sh > +++ b/t/t0302-credential-store.sh > @@ -6,6 +6,11 @@ test_description='credential-store tests' > > helper_test store > > +helper_test_clean store > +test_expect_success 'test cleanup removes everything' ' > + test_must_be_empty "$HOME/.git-credentials" > +' > + > test_expect_success 'when xdg file does not exist, xdg file not created' ' > test_path_is_missing "$HOME/.config/git/credentials" && > test -s "$HOME/.git-credentials" > > -Peff