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

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

From
Michael Witten <mfwitten@gmail.com>
Date
Jul 17, 2012, 16:04 UTC
Message-ID
<679ad82bd4604d1c903f3c2fff2a8cfb-mfwitten@gmail.com>
In-Reply-To
<82316e5034d940e09fed719ae7bfdc3b-mfwitten@gmail.com>
The tests in:
  t/t1306-xdg-files.sh

were failing because the git commands were using the environment variable `XDG_CONFIG_HOME' as it was set for the user's usual environment, rather than as set for the testing environment.

This commit provides the quickest, simplest hack to make things work; because there is already the setting and exporting of the environment variable `HOME' in:

  t/test-lib.sh

this commit simply adds to that file the setting and exporting of the variable `XDG_CONFIG_HOME' (based on the variable `HOME' that is provided there).

However, the existing tests [sometimes] don't use these variables explicitly, so the whole structure of this testing rests on the hope that people maintain the conventions captured by the values of these variables; another commit should fix this instability by using these variables explicitly.

(Note: Double quotes are not needed around the value assigned to the variable, as word splitting is not performed).

Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 t/test-lib.sh | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index acda33d..69bcc75 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -544,6 +544,9 @@ rm -fr "$test" || {
 HOME="$TRASH_DIRECTORY"
 export HOME
 
+XDG_CONFIG_HOME=$HOME/.config
+export XDG_CONFIG_HOME
+
 if test -z "$TEST_NO_CREATE_REPO"; then
 	test_create_repo "$test"
 else
-- 
1.7.11.1.29.gf71be5c
Previous: Michael WittenNext: Jonathan Nieder
Message 2 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.