From: Junio C Hamano Date: Mon, 27 Jan 2020 23:12:21 GMT Subject: Re: [PATCH v5 6/6] config: add '--show-scope' to print the scope of a config value Message-ID: In-Reply-To: <2e979d9fa5066f61eb89e3c1a1a34ac813d71700.1579912764.git.gitgitgadget@gmail.com> "Matthew Rogers via GitGitGadget" writes: > From: Matthew Rogers > > When a user queries config values with --show-origin, often it's > difficult to determine what the actual "scope" (local, global, etc.) of > a given value is based on just the origin file. > > Teach 'git config' the '--show-scope' option to print the scope of all > displayed config values. Note that we should never see anything of > "submodule" scope as that is only ever used by submodule-config.c when > parsing the '.gitmodules' file. > > Signed-off-by: Matthew Rogers > --- > Documentation/git-config.txt | 15 ++++++--- > builtin/config.c | 36 +++++++++++++++++++--- > config.c | 26 +++++++++++++++- > config.h | 21 +++++++------ > submodule-config.c | 4 ++- > t/helper/test-config.c | 19 +----------- > t/t1300-config.sh | 59 ++++++++++++++++++++++++++++++++++++ > 7 files changed, 141 insertions(+), 39 deletions(-) > > diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt > index 899e92a1c9..2e47765aab 100644 > --- a/Documentation/git-config.txt > +++ b/Documentation/git-config.txt > @@ -9,18 +9,18 @@ git-config - Get and set repository or global options > SYNOPSIS > -------- > [verse] > -'git config' [] [--type=] [--show-origin] [-z|--null] name [value [value_regex]] > +'git config' [] [--type=] [--show-origin] [--show-scope] [-z|--null] name [value [value_regex]] > 'git config' [] [--type=] --add name value > 'git config' [] [--type=] --replace-all name value [value_regex] > -'git config' [] [--type=] [--show-origin] [-z|--null] --get name [value_regex] > -'git config' [] [--type=] [--show-origin] [-z|--null] --get-all name [value_regex] > -'git config' [] [--type=] [--show-origin] [-z|--null] [--name-only] --get-regexp name_regex [value_regex] > +'git config' [] [--type=] [--show-origin] [--show-scope] [-z|--null] --get name [value_regex] > +'git config' [] [--type=] [--show-origin] [--show-scope] [-z|--null] --get-all name [value_regex] > +'git config' [] [--type=] [--show-origin] [--show-scope] [-z|--null] [--name-only] --get-regexp name_regex [value_regex] > 'git config' [] [--type=] [-z|--null] --get-urlmatch name URL > 'git config' [] --unset name [value_regex] > 'git config' [] --unset-all name [value_regex] > 'git config' [] --rename-section old_name new_name > 'git config' [] --remove-section name > -'git config' [] [--show-origin] [-z|--null] [--name-only] -l | --list > +'git config' [] [--show-origin] [--show-scope] [-z|--null] [--name-only] -l | --list > 'git config' [] --get-color name [default] > 'git config' [] --get-colorbool name [stdout-is-tty] > 'git config' [] -e | --edit > @@ -222,6 +222,11 @@ Valid ``'s include: > the actual origin (config file path, ref, or blob id if > applicable). > > +--show-scope:: > + Similar to `--show-origin` in that it augments the output of > + all queried config options with the scope of that value There is a trailing SP on this line. I think I fixed it up when I queued the last round on 'pu'. Please double check. > + const char *scope = scope_to_string(current_config_scope()); ??? Are we using scope_to_string() back again? I thought I queued a fix-up patch when I queued the last round on 'pu' to unblock the other topic that wanted to build on top. Please double check. Thanks.