3 test_description
='Test read_early_config()'
7 test_expect_success
'read early config' '
8 test_config early.config correct &&
9 test-config read_early_config early.config >output &&
10 test correct = "$(cat output)"
13 test_expect_success
'in a sub-directory' '
14 test_config early.config sub &&
18 test-config read_early_config early.config
20 test sub = "$(cat output)"
23 test_expect_success
'ceiling' '
24 test_config early.config ceiling &&
27 GIT_CEILING_DIRECTORIES="$PWD" &&
28 export GIT_CEILING_DIRECTORIES &&
30 test-config read_early_config early.config
32 test -z "$(cat output)"
35 test_expect_success
'ceiling #2' '
37 git config -f xdg/git/config early.config xdg &&
38 test_config early.config ceiling &&
41 XDG_CONFIG_HOME="$PWD"/xdg &&
42 GIT_CEILING_DIRECTORIES="$PWD" &&
43 export GIT_CEILING_DIRECTORIES XDG_CONFIG_HOME &&
45 test-config read_early_config early.config
47 test xdg = "$(cat output)"
55 echo "$*" >.git
/config
&&
56 test-config read_early_config early.config
60 test_expect_success
'ignore .git/ with incompatible repository version' '
61 test_with_config "[core]repositoryformatversion = 999999" 2>err &&
62 grep "warning:.* Expected git repo version <= [1-9]" err
65 test_expect_failure
'ignore .git/ with invalid repository version' '
66 test_with_config "[core]repositoryformatversion = invalid"
70 test_expect_failure
'ignore .git/ with invalid config' '