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

Re: [PATCH 1/3] test-lib.sh: unset XDG_CONFIG_HOME

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jul 24, 2012, 12:06 UTC
Message-ID
<vpqpq7l8iss.fsf@bauges.imag.fr>
In-Reply-To
<20120724115305.GA7328@sigill.intra.peff.net>
Thanks (for the 3 patches, all of them look good).
the "unset XDG_CONFIG_HOME" part was already discussed here:
  http://thread.gmane.org/gmane.comp.version-control.git/201609

But Michael did not continue the thread. I think your solution (unset $XDG_CONFIG_HOME instead of setting it to $HOME/.config/git) is better.

In the thread above, I also proposed checking that $XDG_CONFIG_HOME was taken into account, but for the "git config" part (while you test the attributes part).

I think it makes sense to add stg like this to your PATCH 3:
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 &&
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Jeff KingNext: Jeff King
Message 6 of 7 in “test-lib.sh: unset XDG_CONFIG_HOME”
  1. 1/3 test-lib.sh: unset XDG_CONFIG_HOMEJeff King, Jul 24, 2012
  2. 2/3 attr: make sure we have an xdg path before using itJeff King, Jul 24, 2012
  3. ignore: make sure we have an xdg path before using itMatthieu Moy, Jul 24, 2012
  4. Jeff KingJul 24, 2012
  5. 3/3 t1306: check that XDG_CONFIG_HOME worksJeff King, Jul 24, 2012
  6. Matthieu MoyJul 24, 2012
  7. Jeff KingJul 24, 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.