All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
To: Michael Witten <mfwitten@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>,
	Huynh Khoi Nguyen Nguyen 
	<Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>,
	git@vger.kernel.org
Subject: Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable
Date: Tue, 17 Jul 2012 20:14:00 +0200	[thread overview]
Message-ID: <vpqmx2yp85z.fsf@bauges.imag.fr> (raw)
In-Reply-To: <679ad82bd4604d1c903f3c2fff2a8cfb-mfwitten@gmail.com> (Michael Witten's message of "Tue, 17 Jul 2012 16:41:20 -0000")

Michael Witten <mfwitten@gmail.com> writes:

> --- 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/

  parent reply	other threads:[~2012-07-17 18:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-17 17:25 [PATCH 0/3] Testing: XDG config files: Fix broken tests Michael Witten
2012-07-17 16:41 ` [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable Michael Witten
2012-07-17 17:57   ` Jonathan Nieder
2012-07-17 18:14   ` Matthieu Moy [this message]
2012-07-17 18:31     ` Junio C Hamano
2012-07-17 16:41 ` [PATCH 2/3] Testing: XDG config files: Use "$HOME" and "$XDG_CONFIG_HOME" explicitly Michael Witten
2012-07-17 18:19   ` Matthieu Moy
2012-07-17 16:41 ` [PATCH 3/3] Testing: XDG config files: Trivial: `xdg' -> `XDG' Michael Witten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqmx2yp85z.fsf@bauges.imag.fr \
    --to=matthieu.moy@grenoble-inp.fr \
    --cc=Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mfwitten@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.