diff options
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-x | t/t1300-repo-config.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 9e74b1f141..7ddab5fb76 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -694,6 +694,56 @@ test_expect_success 'set --bool-or-int' ' rm .git/config +cat >expect <<\EOF +[path] + home = ~/ + normal = /dev/null + trailingtilde = foo~ +EOF + +test_expect_success 'set --path' ' + git config --path path.home "~/" && + git config --path path.normal "/dev/null" && + 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 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" git config quote.ending "test " git config quote.semicolon "test;test" |