test: fix for COLUMNS and bash 5
[git/debian.git] / t / t1310-config-default.sh
blob6049d9170814320e0d9035c357d76dcfe9887708
1 #!/bin/sh
3 test_description='Test git config in different settings (with --default)'
5 . ./test-lib.sh
7 test_expect_success 'uses --default when entry missing' '
8 echo quux >expect &&
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' '
14 echo bar >expect &&
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' '
20 echo true >expect &&
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
36 test_done