"Matthew Rogers via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Matthew Rogers <mattr94@xxxxxxxxx> > > 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 <mattr94@xxxxxxxxx> > --- > 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' [<file-option>] [--type=<type>] [--show-origin] [-z|--null] name [value [value_regex]] > +'git config' [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] name [value [value_regex]] > 'git config' [<file-option>] [--type=<type>] --add name value > 'git config' [<file-option>] [--type=<type>] --replace-all name value [value_regex] > -'git config' [<file-option>] [--type=<type>] [--show-origin] [-z|--null] --get name [value_regex] > -'git config' [<file-option>] [--type=<type>] [--show-origin] [-z|--null] --get-all name [value_regex] > -'git config' [<file-option>] [--type=<type>] [--show-origin] [-z|--null] [--name-only] --get-regexp name_regex [value_regex] > +'git config' [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] --get name [value_regex] > +'git config' [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] --get-all name [value_regex] > +'git config' [<file-option>] [--type=<type>] [--show-origin] [--show-scope] [-z|--null] [--name-only] --get-regexp name_regex [value_regex] > 'git config' [<file-option>] [--type=<type>] [-z|--null] --get-urlmatch name URL > 'git config' [<file-option>] --unset name [value_regex] > 'git config' [<file-option>] --unset-all name [value_regex] > 'git config' [<file-option>] --rename-section old_name new_name > 'git config' [<file-option>] --remove-section name > -'git config' [<file-option>] [--show-origin] [-z|--null] [--name-only] -l | --list > +'git config' [<file-option>] [--show-origin] [--show-scope] [-z|--null] [--name-only] -l | --list > 'git config' [<file-option>] --get-color name [default] > 'git config' [<file-option>] --get-colorbool name [stdout-is-tty] > 'git config' [<file-option>] -e | --edit > @@ -222,6 +222,11 @@ Valid `<type>`'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.