config: document and test the 'worktree' scope

Test that "git config --show-scope" shows the "worktree" scope, and add it to the list of scopes in Documentation/git-config.txt. "git config --help" does not need to be updated because it already mentions "worktree". Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Glen Choo committed Jun 7, 2022 at 21:24 UTC db7961e6a69f648e8a1359c23830ff59d7341092
2 files changed +10 -1
Documentation/git-config.txt
+1 -1
@@ -248,7 +248,7 @@ Valid `<type>`'s include:
248 --show-scope::
249 Similar to `--show-origin` in that it augments the output of
250 all queried config options with the scope of that value
251 - (local, global, system, command).
251 + (worktree, local, global, system, command).
252
253 --get-colorbool <name> [<stdout-is-tty>]::
254
t/t1300-config.sh
+9
@@ -2024,8 +2024,17 @@ test_expect_success '--show-scope with --list' '
2024 local user.override=local
2025 local include.path=../include/relative.include
2026 local user.relative=include
2027 + local core.repositoryformatversion=1
2028 + local extensions.worktreeconfig=true
2029 + worktree user.worktree=true
2030 command user.cmdline=true
2031 EOF
2032 + git worktree add wt1 &&
2033 + # We need these to test for worktree scope, but outside of this
2034 + # test, this is just noise
2035 + test_config core.repositoryformatversion 1 &&
2036 + test_config extensions.worktreeConfig true &&
2037 + git config --worktree user.worktree true &&
2038 git -c user.cmdline=true config --list --show-scope >output &&
2039 test_cmp expect output
2040 '