git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t/lib-credential: clean additional credential

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 15, 2024, 17:22 UTC
Message-ID
<xmqqle7lskvg.fsf@gitster.g>
In-Reply-To
<20240215043900.GA2821179@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Thu, Feb 15, 2024 at 01:03:56AM +0000, Bo Anderson via GitGitGadget wrote:
>
>> From: Bo Anderson <mail@boanderson.me>
>> 
>> 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 ;-).
Show 19 quoted lines
>
> 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
Previous: Jeff KingNext: Jeff King
Message 3 of 4 in “t/lib-credential: clean additional credential”
  1. t/lib-credential: clean additional credentialBo Anderson via GitGitGadget, Feb 15, 2024
  2. Jeff KingFeb 15, 2024
  3. Junio C HamanoFeb 15, 2024
  4. t0303: check that helper_test_clean removes all credentialsJeff King, Feb 17, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.