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

Re: [PATCH v5 3/3] t0302: test credential-store support for XDG_CONFIG_HOME

From
Johannes Sixt <j6t@kdbg.org>
Date
Mar 25, 2015, 19:03 UTC
Message-ID
<55130693.20607@kdbg.org>
In-Reply-To
<CAPig+cTWnLYU8wU+WjEVpDBuWS7of=wxrWnq7b9W-r=wQh5S1A@mail.gmail.com>
Am 25.03.2015 um 07:42 schrieb Eric Sunshine:
Show 42 quoted lines
> On Tue, Mar 24, 2015 at 1:20 AM, Paul Tan <pyokagan@gmail.com> wrote:
>> t0302 now tests git-credential-store's support for the XDG user-specific
>> configuration file $XDG_CONFIG_HOME/git/credentials. Specifically:
>>
>> * Ensure that the XDG file is strictly opt-in. It should not be created
>>    by git at all times if it does not exist.
>>
>> * Conversely, if the XDG file exists, ~/.git-credentials should
>>    not be created at all times.
>>
>> * If both the XDG file and ~/.git-credentials exists, then both files
>>    should be used for credential lookups. However, credentials should
>>    only be written to ~/.git-credentials.
>>
>> * Credentials must be erased from both files.
>>
>> * $XDG_CONFIG_HOME can be a custom directory set by the user as per the
>>    XDG base directory specification. Test that git-credential-store
>>    respects that, but defaults to "~/.config/git/credentials" if it does
>>    not exist or is empty.
>>
>> Helped-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
>> Helped-by: Junio C Hamano <gitster@pobox.com>
>> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
>> Signed-off-by: Paul Tan <pyokagan@gmail.com>
>> ---
>> diff --git a/t/t0302-credential-store.sh b/t/t0302-credential-store.sh
>> index f61b40c..4e1f8ec 100755
>> --- a/t/t0302-credential-store.sh
>> +++ b/t/t0302-credential-store.sh
>> @@ -6,4 +6,118 @@ test_description='credential-store tests'
>>
>>   helper_test store
>>
>> +test_expect_success 'get: use xdg file if home file is unreadable' '
>
> I meant to mention this earlier. Does this test need to be protected
> by the POSIXPERM prerequisite since it's using chmod?
>
>      test_expect_success POSIXPERM 'get: ... unreadable' '
>
> Otherwise, the test will likely fail on Windows.
Well spotted! The test indeed fails on Windows. POSIXPERM is required.
Show 15 quoted lines
>> +       echo "https://home-user:home-pass@example.com" >"$HOME/.git-credentials" &&
>> +       chmod -r "$HOME/.git-credentials" &&
>> +       mkdir -p "$HOME/.config/git" &&
>> +       echo "https://xdg-user:xdg-pass@example.com" >"$HOME/.config/git/credentials" &&
>> +       check fill store <<-\EOF
>> +       protocol=https
>> +       host=example.com
>> +       --
>> +       protocol=https
>> +       host=example.com
>> +       username=xdg-user
>> +       password=xdg-pass
>> +       --
>> +       EOF
>> +'
-- Hannes
Previous: Eric Sunshine
Message 11 of 11 in “git-credential-store: support multiple credential files”
  1. 1/3 git-credential-store: support multiple credential filesPaul Tan, Mar 24, 2015
  2. 2/3 git-credential-store: support XDG_CONFIG_HOMEPaul Tan, Mar 24, 2015
  3. 3/3 t0302: test credential-store support for XDG_CONFIG_HOMEPaul Tan, Mar 24, 2015
  4. Matthieu MoyMar 24, 2015
  5. Eric SunshineMar 25, 2015
  6. Junio C HamanoMar 25, 2015
  7. Junio C HamanoMar 25, 2015
  8. Paul TanMar 26, 2015
  9. Matthieu MoyMar 26, 2015
  10. Eric SunshineMar 25, 2015
  11. Johannes SixtMar 25, 2015

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.