]>
Commit | Line | Data |
---|---|---|
eeaa24b9 TB |
1 | #!/bin/sh |
2 | ||
3 | test_description='Test git config in different settings (with --default)' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
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 | |
11 | ' | |
12 | ||
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 | |
17 | ' | |
18 | ||
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 | |
23 | ' | |
24 | ||
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 | |
29 | ' | |
30 | ||
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 | |
34 | ' | |
35 | ||
36 | test_done |