git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] config: document and test the 'worktree' scope
@ 2022-06-07 21:24 Glen Choo via GitGitGadget
  2022-06-08  1:14 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Glen Choo via GitGitGadget @ 2022-06-07 21:24 UTC (permalink / raw)
  To: git; +Cc: Matthew Rogers, Philip Oakley, Glen Choo, Glen Choo

From: Glen Choo <chooglen@google.com>

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>
---
    config: document and test the 'worktree' scope
    
    While I was digging through the docs on config scopes for
    discovery.bare, I noticed that Documentation/git-config.txt doesn't
    mention the 'worktree' scope, but the usage string does.
    
    One might assume that since we have CONFIG_SCOPE_WORKTREE, the omission
    from Documentation/git-config.txt is obviously accidental. But, when we
    first added "--show-scope" in 145d59f (config: add '--show-scope' to
    print the scope of a config value, 2020-02-10), we noted that
    'submodule' would never be output from "--show-scope", even though
    CONFIG_SCOPE_SUBMODULE exists.
    
    This patch adds a test that shows "git config -l --show-scope" can
    indeed output 'worktree', and adds the 'worktree' scope to
    Documentation/git-config.txt.
    
    This does not conflict with gc/bare-repo-discovery.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1274%2Fchooglen%2Fdocument-worktree-scope-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1274/chooglen/document-worktree-scope-v1
Pull-Request: https://github.com/git/git/pull/1274

 Documentation/git-config.txt | 2 +-
 t/t1300-config.sh            | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
index bdcfd94b642..9376e39aef2 100644
--- a/Documentation/git-config.txt
+++ b/Documentation/git-config.txt
@@ -248,7 +248,7 @@ Valid `<type>`'s include:
 --show-scope::
 	Similar to `--show-origin` in that it augments the output of
 	all queried config options with the scope of that value
-	(local, global, system, command).
+	(worktree, local, global, system, command).
 
 --get-colorbool <name> [<stdout-is-tty>]::
 
diff --git a/t/t1300-config.sh b/t/t1300-config.sh
index 7dd9b325d90..d3d9adbb3db 100755
--- a/t/t1300-config.sh
+++ b/t/t1300-config.sh
@@ -2024,8 +2024,17 @@ test_expect_success '--show-scope with --list' '
 	local	user.override=local
 	local	include.path=../include/relative.include
 	local	user.relative=include
+	local	core.repositoryformatversion=1
+	local	extensions.worktreeconfig=true
+	worktree	user.worktree=true
 	command	user.cmdline=true
 	EOF
+	git worktree add wt1 &&
+	# We need these to test for worktree scope, but outside of this
+	# test, this is just noise
+	test_config core.repositoryformatversion 1 &&
+	test_config extensions.worktreeConfig true &&
+	git config --worktree user.worktree true &&
 	git -c user.cmdline=true config --list --show-scope >output &&
 	test_cmp expect output
 '

base-commit: ab336e8f1c8009c8b1aab8deb592148e69217085
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] config: document and test the 'worktree' scope
  2022-06-07 21:24 [PATCH] config: document and test the 'worktree' scope Glen Choo via GitGitGadget
@ 2022-06-08  1:14 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-06-08  1:14 UTC (permalink / raw)
  To: Glen Choo via GitGitGadget; +Cc: git, Matthew Rogers, Philip Oakley, Glen Choo

"Glen Choo via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Glen Choo <chooglen@google.com>
>
> 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>
> ---
>     config: document and test the 'worktree' scope
>     
>     While I was digging through the docs on config scopes for
>     discovery.bare, I noticed that Documentation/git-config.txt doesn't
>     mention the 'worktree' scope, but the usage string does.

Excellent.

Thanks, will queue.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-08  4:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07 21:24 [PATCH] config: document and test the 'worktree' scope Glen Choo via GitGitGadget
2022-06-08  1:14 ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).