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

Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2012, 18:31 UTC
Message-ID
<7vliiixmrn.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpqmx2yp85z.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 7 quoted lines
> Before your patches, the correct management of $XDG_CONFIG_HOME to
> override $HOME/.config/git/ was untested (which is unfortunate, indeed),
> but after your patch serie, the fact that the default is
> $HOME/.config/git/ is untested, which IMHO is even worse.
>
> Unsetting XDG_CONFIG_HOME and adding one test like this would be better
> IMHO.

Absolutely. We would want to make sure that the new code does not interfere with established uses when the user does not ask for the new feature (i.e. XDG not set), and also make sure it does what it was meant to do when the feature is called for (i.e. XDG set). It might be true that the set of tests in the series did not test the full spectrum of the latter, but then we would want to see the gap filled by adding missing tests, not by converting tests for former into the ones that test for the latter.

Even with the patch below there may be other gaps in the test. For example, core.excludesfile and core.attributesfile must default to the XDG location when they exist, whether these variables are set; we may want to make sure that is not broken in the future.

Michael, could you change the direction of the patch and look into filling such gaps?

Thanks.
Show 24 quoted lines
> diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh
> index 3c75c3f..f1ea9f1 100755
> --- a/t/t1306-xdg-files.sh
> +++ b/t/t1306-xdg-files.sh
> @@ -38,6 +38,19 @@ test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\''
>         test_cmp expected actual
>  '
>  
> +test_expect_success '"$XDG_CONFIG_HOME overrides $HOME/.config/git' '
> +       mkdir -p "$HOME"/xdg/git/ &&
> +       echo "[user]" >"$HOME"/xdg/git/config &&
> +       echo "  name = in_xdg" >>"$HOME"/xdg/git/config &&
> +       echo in_xdg >expected &&
> +       (
> +               XDG_CONFIG_HOME="$HOME"/xdg/ &&
> +               export XDG_CONFIG_HOME &&
> +               git config --get-all user.name >actual
> +       ) &&
> +       test_cmp expected actual
> +'
> +
>  
>  test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' '
>         >.gitconfig &&
Previous: Matthieu MoyNext: Michael Witten
Message 5 of 8 in “Testing: XDG config files: Fix broken tests”
  1. 0/3 Testing: XDG config files: Fix broken testsMichael Witten, Jul 17, 2012
  2. 1/3 Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variableMichael Witten, Jul 17, 2012
  3. Jonathan NiederJul 17, 2012
  4. Matthieu MoyJul 17, 2012
  5. Junio C HamanoJul 17, 2012
  6. 2/3 Testing: XDG config files: Use "$HOME" and "$XDG_CONFIG_HOME" explicitlyMichael Witten, Jul 17, 2012
  7. Matthieu MoyJul 17, 2012
  8. 3/3 Testing: XDG config files: Trivial: `xdg' -> `XDG'Michael Witten, Jul 17, 2012

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.