Code

(squash) test for previous
[git.git] / t / t1300-repo-config.sh
index 64f05080b65c2b9506d1e34748b47ee721026aef..074f2f2e3e57f76b01f16502998e95b493676711 100755 (executable)
@@ -707,19 +707,41 @@ test_expect_success 'set --path' '
        git config --path path.trailingtilde "foo~" &&
        test_cmp expect .git/config'
 
+if test "${HOME+set}"
+then
+       test_set_prereq HOMEVAR
+fi
+
 cat >expect <<EOF
 $HOME/
 /dev/null
 foo~
 EOF
 
-test_expect_success 'get --path' '
+test_expect_success HOMEVAR 'get --path' '
        git config --get --path path.home > result &&
        git config --get --path path.normal >> result &&
        git config --get --path path.trailingtilde >> result &&
        test_cmp expect result
 '
 
+cat >expect <<\EOF
+/dev/null
+foo~
+EOF
+
+test_expect_success 'get --path copes with unset $HOME' '
+       (
+               unset HOME;
+               test_must_fail git config --get --path path.home \
+                       >result 2>msg &&
+               git config --get --path path.normal >>result &&
+               git config --get --path path.trailingtilde >>result
+       ) &&
+       grep "[Ff]ailed to expand.*~/" msg &&
+       test_cmp expect result
+'
+
 rm .git/config
 
 git config quote.leading " test"