unit-tests: do not mistake `.pdb` files for being executable
[git.git] / t / t1307-config-blob.sh
blob0a7099d6f52b68cf9abc263933267925a994378a
1 #!/bin/sh
3 test_description='support for reading config from a blob'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'create config blob' '
9 cat >config <<-\EOF &&
10 [some]
11 value = 1
12 EOF
13 git add config &&
14 git commit -m foo
17 test_expect_success 'list config blob contents' '
18 echo some.value=1 >expect &&
19 git config --blob=HEAD:config --list >actual &&
20 test_cmp expect actual
23 test_expect_success 'fetch value from blob' '
24 echo true >expect &&
25 git config --blob=HEAD:config --bool some.value >actual &&
26 test_cmp expect actual
29 test_expect_success 'reading non-existing value from blob is an error' '
30 test_must_fail git config --blob=HEAD:config non.existing
33 test_expect_success 'reading from blob and file is an error' '
34 test_must_fail git config --blob=HEAD:config --system --list
37 test_expect_success 'reading from missing ref is an error' '
38 test_must_fail git config --blob=HEAD:doesnotexist --list
41 test_expect_success 'reading from non-blob is an error' '
42 test_must_fail git config --blob=HEAD --list
45 test_expect_success 'setting a value in a blob is an error' '
46 test_must_fail git config --blob=HEAD:config some.value foo
49 test_expect_success 'deleting a value in a blob is an error' '
50 test_must_fail git config --blob=HEAD:config --unset some.value
53 test_expect_success 'editing a blob is an error' '
54 test_must_fail git config --blob=HEAD:config --edit
57 test_expect_success 'parse errors in blobs are properly attributed' '
58 cat >config <<-\EOF &&
59 [some]
60 value = "
61 EOF
62 git add config &&
63 git commit -m broken &&
65 test_must_fail git config --blob=HEAD:config some.value 2>err &&
66 test_i18ngrep "HEAD:config" err
69 test_expect_success 'can parse blob ending with CR' '
70 test_commit --printf CR config "[some]key = value\\r" &&
71 echo value >expect &&
72 git config --blob=HEAD:config some.key >actual &&
73 test_cmp expect actual
76 test_expect_success 'config --blob outside of a repository is an error' '
77 nongit test_must_fail git config --blob=foo --list
80 test_done