Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/git/blob/master/t/t1311-config-optional.sh # git [Ported from github.com/git/git] Sync with Git 2.56.1 Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `git / t / t1311-config-optional.sh` 38 lines ยท 1027 bytes Raw Blame History 1 #!/bin/sh 2 # 3 # Copyright (c) 2025 Google LLC 4 # 5 6 test_description=':(optional) paths' 7 8 . ./test-lib.sh 9 10 test_expect_success 'var=:(optional)path-exists' ' 11 test_config a.path ":(optional)path-exists" && 12 >path-exists && 13 echo path-exists >expect && 14 15 git config get --path a.path >actual && 16 test_cmp expect actual 17 ' 18 19 test_expect_success 'missing optional value is ignored' ' 20 test_config a.path ":(optional)no-such-path" && 21 # Using --show-scope ensures we skip writing not only the value 22 # but also any meta-information about the ignored key. 23 test_must_fail git config get --show-scope --path a.path >actual && 24 test_line_count = 0 actual 25 ' 26 27 test_expect_success 'missing optional value is ignored in multi-value config' ' 28 test_when_finished "git config unset --all a.path" && 29 git config set --append a.path ":(optional)path-exists" && 30 git config set --append a.path ":(optional)no-such-path" && 31 >path-exists && 32 echo path-exists >expect && 33 34 git config --get --path a.path >actual && 35 test_cmp expect actual 36 ' 37 38 test_done