3 test_description
='Test git config in different settings (with --default)'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 test_expect_success
'uses --default when entry missing' '
10 git config -f config --default=quux core.foo >actual &&
11 test_cmp expect actual
14 test_expect_success
'does not use --default when entry present' '
16 git -c core.foo=bar config --default=baz core.foo >actual &&
17 test_cmp expect actual
20 test_expect_success
'canonicalizes --default with appropriate type' '
22 git config -f config --default=yes --bool core.foo >actual &&
23 test_cmp expect actual
26 test_expect_success
'dies when --default cannot be parsed' '
27 test_must_fail git config -f config --type=expiry-date --default=x --get \
28 not.a.section 2>error &&
29 test_i18ngrep "failed to format default config value" error
32 test_expect_success
'does not allow --default without --get' '
33 test_must_fail git config --default=quux --unset a.section >output 2>&1 &&
34 test_i18ngrep "\-\-default is only applicable to" output