{"thread":{"id":"31045","subject":"[PATCH 0/3] Testing: XDG config files: Fix broken tests","startedAt":"2012-07-17T16:04:29Z","lastAt":"2012-07-17T18:31:24Z","messageCount":8,"participants":["Michael Witten","Jonathan Nieder","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"195207","messageId":"82316e5034d940e09fed719ae7bfdc3b-mfwitten@gmail.com","threadId":"31045","inReplyTo":null,"subject":"[PATCH 0/3] Testing: XDG config files: Fix broken tests","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":null,"receivedAt":"2012-07-17T16:04:29Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"The tests for the new XDG config file code are broken because the\nenvironoment variable `XDG_CONFIG_HOME' is never set properly,\nand the tests themselves do not use `XDG_CONFIG_HOME' or `HOME'\nexplicitly.\n\nThe following patch series corrects this brittleness (and the\nfailures to which it has led):\n\n  t/t1306-xdg-files.sh | 69 +++++++++++++++++++++++++++-------------------------\n  t/test-lib.sh        |  3 +++\n  2 files changed, 39 insertions(+), 33 deletions(-)\n\n  [1] Export a suitable `XDG_CONFIG_HOME' environment variable\n  [2] Use \"$HOME\" and \"$XDG_CONFIG_HOME\" explicitly\n  [3] Trivial: `xdg' -> `XDG'\n\n\n-- \n1.7.11.1.29.gf71be5c\n"},{"id":"195208","messageId":"679ad82bd4604d1c903f3c2fff2a8cfb-mfwitten@gmail.com","threadId":"31045","inReplyTo":"82316e5034d940e09fed719ae7bfdc3b-mfwitten@gmail.com","subject":"[PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":null,"receivedAt":"2012-07-17T16:04:29Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"The tests in:\n\n  t/t1306-xdg-files.sh\n\nwere failing because the git commands were using the environment\nvariable `XDG_CONFIG_HOME' as it was set for the user's usual\nenvironment, rather than as set for the testing environment.\n\nThis commit provides the quickest, simplest hack to make things work;\nbecause there is already the setting and exporting of the environment\nvariable `HOME' in:\n\n  t/test-lib.sh\n\nthis commit simply adds to that file the setting and exporting of\nthe variable `XDG_CONFIG_HOME' (based on the variable `HOME' that is\nprovided there).\n\nHowever, the existing tests [sometimes] don't use these variables\nexplicitly, so the whole structure of this testing rests on the\nhope that people maintain the conventions captured by the values\nof these variables; another commit should fix this instability\nby using these variables explicitly.\n\n(Note: Double quotes are not needed around the value assigned\nto the variable, as word splitting is not performed).\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n t/test-lib.sh | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex acda33d..69bcc75 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -544,6 +544,9 @@ rm -fr \"$test\" || {\n HOME=\"$TRASH_DIRECTORY\"\n export HOME\n \n+XDG_CONFIG_HOME=$HOME/.config\n+export XDG_CONFIG_HOME\n+\n if test -z \"$TEST_NO_CREATE_REPO\"; then\n \ttest_create_repo \"$test\"\n else\n-- \n1.7.11.1.29.gf71be5c\n"},{"id":"195210","messageId":"e118f47351094d4fb45dd34bc08b9e9b-mfwitten@gmail.com","threadId":"31045","inReplyTo":"82316e5034d940e09fed719ae7bfdc3b-mfwitten@gmail.com","subject":"[PATCH 2/3] Testing: XDG config files: Use \"$HOME\" and \"$XDG_CONFIG_HOME\" explicitly","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":null,"receivedAt":"2012-07-17T17:44:46Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"The tests in:\n\n  t/t1306-xdg-files.sh\n\nrelied on brittle conventions:\n\n  * \"$HOME\" and \"$XDG_CONFIG_HOME\" having certain values.\n\n  * The testing commands having a certain current working\n    directory; at least one test failed as a result.\n\nThis commit mitigates the problem by using the variables \"$HOME\"\nand \"$XDG_CONFIG_HOME\" explicitly.\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n t/t1306-xdg-files.sh | 69 +++++++++++++++++++++++++++-------------------------\n 1 file changed, 36 insertions(+), 33 deletions(-)\n\ndiff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh\nindex 3c75c3f..2327047 100755\n--- a/t/t1306-xdg-files.sh\n+++ b/t/t1306-xdg-files.sh\n@@ -9,58 +9,60 @@ test_description='Compatibility with $XDG_CONFIG_HOME/git/ files'\n \n . ./test-lib.sh\n \n+GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git\n+\n-test_expect_success 'read config: xdg file exists and ~/.gitconfig doesn'\\''t' '\n+test_expect_success 'read config: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n-\tmkdir -p .config/git &&\n+\tmkdir -p \"$GIT_CONFIG_DIR\" &&\n-\techo \"[alias]\" >.config/git/config &&\n+\techo \"[alias]\" >\"$GIT_CONFIG_DIR\"/config &&\n-\techo \"\tmyalias = !echo in_config\" >>.config/git/config &&\n+\techo \"\tmyalias = !echo in_config\" >>\"$GIT_CONFIG_DIR\"/config &&\n \techo in_config >expected &&\n \tgit myalias >actual &&\n \ttest_cmp expected actual\n '\n \n \n-test_expect_success 'read config: xdg file exists and ~/.gitconfig exists' '\n+test_expect_success 'read config: xdg file exists and \"$HOME\"/.gitconfig exists' '\n-\t>.gitconfig &&\n+\t>\"$HOME\"/.gitconfig &&\n-\techo \"[alias]\" >.gitconfig &&\n+\techo \"[alias]\" >\"$HOME\"/.gitconfig &&\n-\techo \"\tmyalias = !echo in_gitconfig\" >>.gitconfig &&\n+\techo \"\tmyalias = !echo in_gitconfig\" >>\"$HOME\"/.gitconfig &&\n \techo in_gitconfig >expected &&\n \tgit myalias >actual &&\n \ttest_cmp expected actual\n '\n \n \n-test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\\''t' '\n+test_expect_success 'read with --get: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n-\trm .gitconfig &&\n+\trm \"$HOME\"/.gitconfig &&\n-\techo \"[user]\" >.config/git/config &&\n+\techo \"[user]\" >\"$GIT_CONFIG_DIR\"/config &&\n-\techo \"\tname = read_config\" >>.config/git/config &&\n+\techo \"\tname = read_config\" >>\"$GIT_CONFIG_DIR\"/config &&\n \techo read_config >expected &&\n \tgit config --get user.name >actual &&\n \ttest_cmp expected actual\n '\n \n \n-test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' '\n+test_expect_success 'read with --get: xdg file exists and \"$HOME\"/.gitconfig exists' '\n-\t>.gitconfig &&\n+\t>\"$HOME\"/.gitconfig &&\n-\techo \"[user]\" >.gitconfig &&\n+\techo \"[user]\" >\"$HOME\"/.gitconfig &&\n-\techo \"\tname = read_gitconfig\" >>.gitconfig &&\n+\techo \"\tname = read_gitconfig\" >>\"$HOME\"/.gitconfig &&\n \techo read_gitconfig >expected &&\n \tgit config --get user.name >actual &&\n \ttest_cmp expected actual\n '\n \n \n-test_expect_success 'read with --list: xdg file exists and ~/.gitconfig doesn'\\''t' '\n+test_expect_success 'read with --list: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n-\trm .gitconfig &&\n+\trm \"$HOME\"/.gitconfig &&\n \techo user.name=read_config >expected &&\n \tgit config --global --list >actual &&\n \ttest_cmp expected actual\n '\n \n \n-test_expect_success 'read with --list: xdg file exists and ~/.gitconfig exists' '\n+test_expect_success 'read with --list: xdg file exists and \"$HOME\"/.gitconfig exists' '\n-\t>.gitconfig &&\n+\t>\"$HOME\"/.gitconfig &&\n-\techo \"[user]\" >.gitconfig &&\n+\techo \"[user]\" >\"$HOME\"/.gitconfig &&\n-\techo \"\tname = read_gitconfig\" >>.gitconfig &&\n+\techo \"\tname = read_gitconfig\" >>\"$HOME\"/.gitconfig &&\n \techo user.name=read_gitconfig >expected &&\n \tgit config --global --list >actual &&\n \ttest_cmp expected actual\n@@ -75,8 +77,8 @@ test_expect_success 'Setup' '\n \n \n test_expect_success 'Exclusion of a file in the XDG ignore file' '\n-\tmkdir -p \"$HOME\"/.config/git/ &&\n+\tmkdir -p \"$GIT_CONFIG_DIR\" &&\n-\techo to_be_excluded >\"$HOME\"/.config/git/ignore &&\n+\techo to_be_excluded >\"$GIT_CONFIG_DIR\"/ignore &&\n \ttest_must_fail git add to_be_excluded\n '\n \n@@ -89,7 +91,7 @@ test_expect_success 'Exclusion in both XDG and local ignore files' '\n \n test_expect_success 'Exclusion in a non-XDG global ignore file' '\n \trm .gitignore &&\n-\techo >\"$HOME\"/.config/git/ignore &&\n+\techo >\"$GIT_CONFIG_DIR\"/ignore &&\n \techo to_be_excluded >\"$HOME\"/my_gitignore &&\n \tgit config core.excludesfile \"$HOME\"/my_gitignore &&\n \ttest_must_fail git add to_be_excluded\n@@ -100,7 +102,7 @@ test_expect_success 'Checking attributes in the XDG attributes file' '\n \techo foo >f &&\n \tgit check-attr -a f >actual &&\n \ttest_line_count -eq 0 actual &&\n-\techo \"f attr_f\" >\"$HOME\"/.config/git/attributes &&\n+\techo \"f attr_f\" >\"$GIT_CONFIG_DIR\"/attributes &&\n \techo \"f: attr_f: set\" >expected &&\n \tgit check-attr -a f >actual &&\n \ttest_cmp expected actual\n@@ -125,18 +127,18 @@ test_expect_success 'Checking attributes in a non-XDG global attributes file' '\n '\n \n \n-test_expect_success 'write: xdg file exists and ~/.gitconfig doesn'\\''t' '\n+test_expect_success 'write: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n-\tmkdir -p \"$HOME\"/.config/git &&\n+\tmkdir -p \"$GIT_CONFIG_DIR\" &&\n-\t>\"$HOME\"/.config/git/config &&\n+\t>\"$GIT_CONFIG_DIR\"/config &&\n \ttest_might_fail rm \"$HOME\"/.gitconfig &&\n \tgit config --global user.name \"write_config\" &&\n \techo \"[user]\" >expected &&\n \techo \"\tname = write_config\" >>expected &&\n-\ttest_cmp expected \"$HOME\"/.config/git/config\n+\ttest_cmp expected \"$GIT_CONFIG_DIR\"/config\n '\n \n \n-test_expect_success 'write: xdg file exists and ~/.gitconfig exists' '\n+test_expect_success 'write: xdg file exists and \"$HOME\"/.gitconfig exists' '\n \t>\"$HOME\"/.gitconfig &&\n \tgit config --global user.name \"write_gitconfig\" &&\n \techo \"[user]\" >expected &&\n@@ -145,14 +147,15 @@ test_expect_success 'write: xdg file exists and ~/.gitconfig exists' '\n '\n \n \n-test_expect_success 'write: ~/.config/git/ exists and config file doesn'\\''t' '\n+test_expect_success 'write: \"$XDG_CONFIG_HOME/git\" exists and config file doesn'\\''t' '\n \ttest_might_fail rm \"$HOME\"/.gitconfig &&\n-\ttest_might_fail rm \"$HOME\"/.config/git/config &&\n+\ttest_might_fail rm \"$GIT_CONFIG_DIR\"/config &&\n \tgit config --global user.name \"write_gitconfig\" &&\n \techo \"[user]\" >expected &&\n \techo \"\tname = write_gitconfig\" >>expected &&\n \ttest_cmp expected \"$HOME\"/.gitconfig\n '\n \n+unset GIT_CONFIG_DIR\n \n test_done\n-- \n1.7.11.1.29.gf71be5c\n"},{"id":"195211","messageId":"a4dd97acf90340c1b07e52a20c33c594-mfwitten@gmail.com","threadId":"31045","inReplyTo":"82316e5034d940e09fed719ae7bfdc3b-mfwitten@gmail.com","subject":"[PATCH 3/3] Testing: XDG config files: Trivial: `xdg' -> `XDG'","fromName":"Michael Witten","fromEmail":"mfwitten@gmail.com","sentAt":null,"receivedAt":"2012-07-17T17:44:46Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"For the sake of consistency and correctness, the acronymn `xdg'\nhas been capitalized (`XDG').\n\nSigned-off-by: Michael Witten <mfwitten@gmail.com>\n---\n t/t1306-xdg-files.sh | 16 ++++++++--------\n 1 file changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh\nindex 2327047..6a3ab09 100755\n--- a/t/t1306-xdg-files.sh\n+++ b/t/t1306-xdg-files.sh\n@@ -11,7 +11,7 @@\n \n GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git\n \n-test_expect_success 'read config: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n+test_expect_success 'read config: XDG file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n \tmkdir -p \"$GIT_CONFIG_DIR\" &&\n \techo \"[alias]\" >\"$GIT_CONFIG_DIR\"/config &&\n \techo \"\tmyalias = !echo in_config\" >>\"$GIT_CONFIG_DIR\"/config &&\n@@ -21,7 +21,7 @@\n '\n \n \n-test_expect_success 'read config: xdg file exists and \"$HOME\"/.gitconfig exists' '\n+test_expect_success 'read config: XDG file exists and \"$HOME\"/.gitconfig exists' '\n \t>\"$HOME\"/.gitconfig &&\n \techo \"[alias]\" >\"$HOME\"/.gitconfig &&\n \techo \"\tmyalias = !echo in_gitconfig\" >>\"$HOME\"/.gitconfig &&\n@@ -31,7 +31,7 @@\n '\n \n \n-test_expect_success 'read with --get: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n+test_expect_success 'read with --get: XDG file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n \trm \"$HOME\"/.gitconfig &&\n \techo \"[user]\" >\"$GIT_CONFIG_DIR\"/config &&\n \techo \"\tname = read_config\" >>\"$GIT_CONFIG_DIR\"/config &&\n@@ -41,7 +41,7 @@\n '\n \n \n-test_expect_success 'read with --get: xdg file exists and \"$HOME\"/.gitconfig exists' '\n+test_expect_success 'read with --get: XDG file exists and \"$HOME\"/.gitconfig exists' '\n \t>\"$HOME\"/.gitconfig &&\n \techo \"[user]\" >\"$HOME\"/.gitconfig &&\n \techo \"\tname = read_gitconfig\" >>\"$HOME\"/.gitconfig &&\n@@ -51,7 +51,7 @@\n '\n \n \n-test_expect_success 'read with --list: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n+test_expect_success 'read with --list: XDG file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n \trm \"$HOME\"/.gitconfig &&\n \techo user.name=read_config >expected &&\n \tgit config --global --list >actual &&\n@@ -59,7 +59,7 @@\n '\n \n \n-test_expect_success 'read with --list: xdg file exists and \"$HOME\"/.gitconfig exists' '\n+test_expect_success 'read with --list: XDG file exists and \"$HOME\"/.gitconfig exists' '\n \t>\"$HOME\"/.gitconfig &&\n \techo \"[user]\" >\"$HOME\"/.gitconfig &&\n \techo \"\tname = read_gitconfig\" >>\"$HOME\"/.gitconfig &&\n@@ -127,7 +127,7 @@\n '\n \n \n-test_expect_success 'write: xdg file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n+test_expect_success 'write: XDG file exists and \"$HOME\"/.gitconfig doesn'\\''t' '\n \tmkdir -p \"$GIT_CONFIG_DIR\" &&\n \t>\"$GIT_CONFIG_DIR\"/config &&\n \ttest_might_fail rm \"$HOME\"/.gitconfig &&\n@@ -138,7 +138,7 @@\n '\n \n \n-test_expect_success 'write: xdg file exists and \"$HOME\"/.gitconfig exists' '\n+test_expect_success 'write: XDG file exists and \"$HOME\"/.gitconfig exists' '\n \t>\"$HOME\"/.gitconfig &&\n \tgit config --global user.name \"write_gitconfig\" &&\n \techo \"[user]\" >expected &&\n-- \n1.7.11.1.29.gf71be5c\n"},{"id":"195212","messageId":"20120717175740.GA14361@burratino","threadId":"31045","inReplyTo":"679ad82bd4604d1c903f3c2fff2a8cfb-mfwitten@gmail.com","subject":"Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-07-17T17:57:40Z","receivedAt":"2012-07-17T17:57:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nMichael Witten wrote:\n\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -544,6 +544,9 @@ rm -fr \"$test\" || {\n>  HOME=\"$TRASH_DIRECTORY\"\n>  export HOME\n>  \n> +XDG_CONFIG_HOME=$HOME/.config\n> +export XDG_CONFIG_HOME\n> +\n\nI think this is a bad idea.  The typical case is for XDG_CONFIG_HOME\nnot to be set, and we need to make sure git works well in the typical\ncase.\n\nBut the general idea seems sane --- how about\n\n\tunset VISUAL EMAIL LANGUAGE COLUMNS XDG_CONFIG_HOME $(perl -e '\n\t\t...\n\n?\n"},{"id":"195213","messageId":"vpqmx2yp85z.fsf@bauges.imag.fr","threadId":"31045","inReplyTo":"679ad82bd4604d1c903f3c2fff2a8cfb-mfwitten@gmail.com","subject":"Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-17T18:14:00Z","receivedAt":"2012-07-17T18:14:00Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -544,6 +544,9 @@ rm -fr \"$test\" || {\n>  HOME=\"$TRASH_DIRECTORY\"\n>  export HOME\n>  \n> +XDG_CONFIG_HOME=$HOME/.config\n> +export XDG_CONFIG_HOME\n> +\n\nWhy not just unset XDG_CONFIG_HOME?\n\nYour match makes it look like XDG_CONFIG_HOME is required to use the\nconfiguration directory, but it is not. To me, the main feature is the\nability to use $HOME/.config/git/ as a configuration directory (this is\nnot just a convention, this is a documented feature), and the management\nof the variable $XDG_CONFIG_HOME is just a bonnus.\n\nBefore your patches, the correct management of $XDG_CONFIG_HOME to\noverride $HOME/.config/git/ was untested (which is unfortunate, indeed),\nbut after your patch serie, the fact that the default is\n$HOME/.config/git/ is untested, which IMHO is even worse.\n\nUnsetting XDG_CONFIG_HOME and adding one test like this would be better\nIMHO.\n\ndiff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh\nindex 3c75c3f..f1ea9f1 100755\n--- a/t/t1306-xdg-files.sh\n+++ b/t/t1306-xdg-files.sh\n@@ -38,6 +38,19 @@ test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\\''\n        test_cmp expected actual\n '\n \n+test_expect_success '\"$XDG_CONFIG_HOME overrides $HOME/.config/git' '\n+       mkdir -p \"$HOME\"/xdg/git/ &&\n+       echo \"[user]\" >\"$HOME\"/xdg/git/config &&\n+       echo \"  name = in_xdg\" >>\"$HOME\"/xdg/git/config &&\n+       echo in_xdg >expected &&\n+       (\n+               XDG_CONFIG_HOME=\"$HOME\"/xdg/ &&\n+               export XDG_CONFIG_HOME &&\n+               git config --get-all user.name >actual\n+       ) &&\n+       test_cmp expected actual\n+'\n+\n \n test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' '\n        >.gitconfig &&\n\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"195214","messageId":"vpqehoap7x7.fsf@bauges.imag.fr","threadId":"31045","inReplyTo":"e118f47351094d4fb45dd34bc08b9e9b-mfwitten@gmail.com","subject":"Re: [PATCH 2/3] Testing: XDG config files: Use \"$HOME\" and \"$XDG_CONFIG_HOME\" explicitly","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-07-17T18:19:16Z","receivedAt":"2012-07-17T18:19:16Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Michael Witten <mfwitten@gmail.com> writes:\n\n> The tests in:\n>\n>   t/t1306-xdg-files.sh\n>\n> relied on brittle conventions:\n>\n>   * \"$HOME\" and \"$XDG_CONFIG_HOME\" having certain values.\n>\n>   * The testing commands having a certain current working\n>     directory;\n\nOther tests (t1305-config-include.sh at least) use the fact that the\ntests are ran in $HOME. I'm not sure if we want to change that.\n\nAbout XDG_CONFIG_HOME, the tests were just assuming it was unset.\n\n> +GIT_CONFIG_DIR=$XDG_CONFIG_HOME/git\n\nAs I said in my earlier message, I'd rather test the default value\n($HOME/.config/git) than the particular case whe $XDG_CONFIG_HOME is\nset.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"195215","messageId":"7vliiixmrn.fsf@alter.siamese.dyndns.org","threadId":"31045","inReplyTo":"vpqmx2yp85z.fsf@bauges.imag.fr","subject":"Re: [PATCH 1/3] Testing: XDG config files: Export a suitable `XDG_CONFIG_HOME' environment variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-07-17T18:31:24Z","receivedAt":"2012-07-17T18:31:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Before your patches, the correct management of $XDG_CONFIG_HOME to\n> override $HOME/.config/git/ was untested (which is unfortunate, indeed),\n> but after your patch serie, the fact that the default is\n> $HOME/.config/git/ is untested, which IMHO is even worse.\n>\n> Unsetting XDG_CONFIG_HOME and adding one test like this would be better\n> IMHO.\n\nAbsolutely.  We would want to make sure that the new code does not\ninterfere with established uses when the user does not ask for the\nnew feature (i.e. XDG not set), and also make sure it does what it\nwas meant to do when the feature is called for (i.e. XDG set).  It\nmight be true that the set of tests in the series did not test the\nfull spectrum of the latter, but then we would want to see the gap\nfilled by adding missing tests, not by converting tests for former\ninto the ones that test for the latter.\n\nEven with the patch below there may be other gaps in the test. For\nexample, core.excludesfile and core.attributesfile must default to\nthe XDG location when they exist, whether these variables are set;\nwe may want to make sure that is not broken in the future.\n\nMichael, could you change the direction of the patch and look into\nfilling such gaps?\n\nThanks.\n\n> diff --git a/t/t1306-xdg-files.sh b/t/t1306-xdg-files.sh\n> index 3c75c3f..f1ea9f1 100755\n> --- a/t/t1306-xdg-files.sh\n> +++ b/t/t1306-xdg-files.sh\n> @@ -38,6 +38,19 @@ test_expect_success 'read with --get: xdg file exists and ~/.gitconfig doesn'\\''\n>         test_cmp expected actual\n>  '\n>  \n> +test_expect_success '\"$XDG_CONFIG_HOME overrides $HOME/.config/git' '\n> +       mkdir -p \"$HOME\"/xdg/git/ &&\n> +       echo \"[user]\" >\"$HOME\"/xdg/git/config &&\n> +       echo \"  name = in_xdg\" >>\"$HOME\"/xdg/git/config &&\n> +       echo in_xdg >expected &&\n> +       (\n> +               XDG_CONFIG_HOME=\"$HOME\"/xdg/ &&\n> +               export XDG_CONFIG_HOME &&\n> +               git config --get-all user.name >actual\n> +       ) &&\n> +       test_cmp expected actual\n> +'\n> +\n>  \n>  test_expect_success 'read with --get: xdg file exists and ~/.gitconfig exists' '\n>         >.gitconfig &&\n"}]}