t1092: stress test 'git sparse-checkout set'
[git/debian.git] / t / t1310-config-default.sh
blob09b10c144ba9d162635a12d66b8796b9cd94fb6c
1 #!/bin/sh
3 test_description='Test git config in different settings (with --default)'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'uses --default when entry missing' '
9 echo quux >expect &&
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' '
15 echo bar >expect &&
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' '
21 echo true >expect &&
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
37 test_done