Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:54:16
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Michael Witten [off-list ref] writes:
quoted hunk
--- 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
+
Why not just unset XDG_CONFIG_HOME?

Your match makes it look like XDG_CONFIG_HOME is required to use the
configuration directory, but it is not. To me, the main feature is the
ability to use $HOME/.config/git/ as a configuration directory (this is
not just a convention, this is a documented feature), and the management
of the variable $XDG_CONFIG_HOME is just a bonnus.

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.
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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help