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