On Tue, Jul 24, 2012 at 02:06:43PM +0200, Matthieu Moy wrote:
> 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.
Yeah, setting it to $HOME/.config/git is actively wrong; I agree with
the reasoning in that thread (which I did not read until just now).
> 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).
Yeah, I see.
> I think it makes sense to add stg like this to your PATCH 3:
Agreed. And one for the exclude section, too, just for completeness.
Revised patch 3 is below.
-- >8 --
Subject: [PATCHv2 3/3] t1306: check that XDG_CONFIG_HOME works
This should override $HOME/.config, but we never actually
tested it.
---
t/t1306-xdg-files.sh | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh
index 1569596..a62c3fb 100755
--- a/t/t1306-xdg-files.sh
+++ b/t/t1306-xdg-files.sh
@@ -38,6 +38,13 @@ 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]name = in_xdg" >"$HOME"/xdg/git/config &&
+ echo in_xdg >expected &&
+ XDG_CONFIG_HOME="$HOME"/xdg git config --get-all user.name >actual &&
+ test_cmp expected actual
+'
test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists'
'
>.gitconfig &&
@@ -80,6 +87,17 @@ test_expect_success 'Exclusion of a file in the XDG ignore
file' '
test_must_fail git add to_be_excluded
'
+test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/ignore' '
+ mkdir -p "$HOME"/xdg/git &&
+ echo content >excluded_by_xdg_only &&
+ echo excluded_by_xdg_only >"$HOME"/xdg/git/ignore &&
+ test_when_finished "git read-tree --empty" &&
+ (XDG_CONFIG_HOME="$HOME/xdg" &&
+ export XDG_CONFIG_HOME &&
+ git add to_be_excluded &&
+ test_must_fail git add excluded_by_xdg_only
+ )
+'
test_expect_success 'Exclusion in both XDG and local ignore files' '
echo to_be_excluded >.gitignore &&
@@ -113,6 +131,14 @@ test_expect_success 'Checking XDG attributes when HOME is
unset' '
test_cmp expected actual
'
+test_expect_success '$XDG_CONFIG_HOME overrides $HOME/.config/attributes' '
+ mkdir -p "$HOME"/xdg/git &&
+ echo "f attr_f=xdg" >"$HOME"/xdg/git/attributes &&
+ echo "f: attr_f: xdg" >expected &&
+ XDG_CONFIG_HOME="$HOME/xdg" git check-attr -a f >actual &&
+ test_cmp expected actual
+'
+
test_expect_success 'Checking attributes in both XDG and local attributes
files' '
echo "f -attr_f" >.gitattributes &&
echo "f: attr_f: unset" >expected &&
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html