git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Matthew Rogers via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Matthew Rogers <mattr94@gmail.com>
Subject: [PATCH v6 0/6] config: allow user to know scope of config options
Date: Wed, 29 Jan 2020 03:34:19 +0000	[thread overview]
Message-ID: <pull.478.v6.git.1580268865.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.478.v5.git.1579912764.gitgitgadget@gmail.com>

This was originally a pull request to the git-for-windows repository
[https://github.com/git-for-windows/git/pull/2399]. It adds a new option
--show-scope which would allow a user to see what scope a given
configuration value has (sytem, local, global, etc.).

changes since v4:

 * final cleanups

Matthew Rogers (6):
  config: fix typo in variable name
  t1300: fix over-indented HERE-DOCs
  t1300: create custom config file without special characters
  config: split repo scope to local and worktree
  config: clarify meaning of command line scoping
  config: add '--show-scope' to print the scope of a config value

 Documentation/git-config.txt |  15 ++-
 builtin/config.c             |  46 +++++--
 config.c                     |  35 ++++-
 config.h                     |  20 +--
 remote.c                     |   3 +-
 submodule-config.c           |   4 +-
 t/helper/test-config.c       |  17 +--
 t/t1300-config.sh            | 240 ++++++++++++++++++++++-------------
 t/t1308-config-set.sh        |   4 +-
 upload-pack.c                |   3 +-
 10 files changed, 248 insertions(+), 139 deletions(-)


base-commit: c7a62075917b3340f908093f63f1161c44ed1475
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-478%2FROGERSM94%2Fadd-config-flags-v6
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-478/ROGERSM94/add-config-flags-v6
Pull-Request: https://github.com/gitgitgadget/git/pull/478

Range-diff vs v5:

 1:  f5a81a4d25 ! 1:  18f92f70cf config: fix typo in variable name
     @@ -8,6 +8,7 @@
          malapropism is being fixed.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/builtin/config.c b/builtin/config.c
       --- a/builtin/config.c
 2:  1b42f85399 ! 2:  dc7b3f3b96 t1300: fix over-indented HERE-DOCs
     @@ -6,6 +6,7 @@
          HERE-DOCs used in config tests.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/t/t1300-config.sh b/t/t1300-config.sh
       --- a/t/t1300-config.sh
 3:  9d19794dfd ! 3:  975e652368 t1300: create custom config file without special characters
     @@ -12,6 +12,7 @@
          appropriate for general use.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/t/t1300-config.sh b/t/t1300-config.sh
       --- a/t/t1300-config.sh
 4:  9f160e281a ! 4:  1e406ba430 config: split repo scope to local and worktree
     @@ -22,6 +22,7 @@
          CONFIG_SCOPE_WORKTREE and CONFIG_SCOPE_LOCAL to preserve previous behavior.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/config.c b/config.c
       --- a/config.c
     @@ -81,8 +82,9 @@
       	case CONFIG_SCOPE_GLOBAL:
       		return "global";
      -	case CONFIG_SCOPE_REPO:
     +-		return "repo";
      +	case CONFIG_SCOPE_LOCAL:
     - 		return "repo";
     ++		return "local";
      +	case CONFIG_SCOPE_WORKTREE:
      +		return "worktree";
       	case CONFIG_SCOPE_CMDLINE:
 5:  7f00f8559d ! 5:  936ce91c62 config: clarify meaning of command line scoping
     @@ -12,6 +12,7 @@
          CONFIG_SCOPE_CMDLINE redundant.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/config.c b/config.c
       --- a/config.c
     @@ -43,7 +44,7 @@
       --- a/t/helper/test-config.c
       +++ b/t/helper/test-config.c
      @@
     - 		return "repo";
     + 		return "local";
       	case CONFIG_SCOPE_WORKTREE:
       		return "worktree";
      -	case CONFIG_SCOPE_CMDLINE:
 6:  2e979d9fa5 ! 6:  fc141e8689 config: add '--show-scope' to print the scope of a config value
     @@ -12,6 +12,7 @@
          parsing the '.gitmodules' file.
      
          Signed-off-by: Matthew Rogers <mattr94@gmail.com>
     +    Signed-off-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt
       --- a/Documentation/git-config.txt
     @@ -46,7 +47,7 @@
       
      +--show-scope::
      +	Similar to `--show-origin` in that it augments the output of
     -+	all queried config options with the scope of that value 
     ++	all queried config options with the scope of that value
      +	(local, global, system, command).
      +
       --get-colorbool name [stdout-is-tty]::
     @@ -79,7 +80,7 @@
      +static void show_config_scope(struct strbuf *buf)
      +{
      +	const char term = end_nul ? '\0' : '\t';
     -+	const char *scope = scope_to_string(current_config_scope());
     ++	const char *scope = config_scope_name(current_config_scope());
      +
      +	strbuf_addstr(buf, N_(scope));
      +	strbuf_addch(buf, term);
     @@ -195,7 +196,7 @@
       	}
       }
       
     -+const char *scope_to_string(enum config_scope scope)
     ++const char *config_scope_name(enum config_scope scope)
      +{
      +	switch (scope) {
      +	case CONFIG_SCOPE_SYSTEM:
     @@ -235,7 +236,7 @@
      +	CONFIG_SCOPE_COMMAND,
      +	CONFIG_SCOPE_SUBMODULE,
      +};
     -+const char *scope_to_string(enum config_scope scope);
     ++const char *config_scope_name(enum config_scope scope);
      +
       struct git_config_source {
       	unsigned int use_stdin:1;
     @@ -292,7 +293,7 @@
      -	case CONFIG_SCOPE_GLOBAL:
      -		return "global";
      -	case CONFIG_SCOPE_LOCAL:
     --		return "repo";
     +-		return "local";
      -	case CONFIG_SCOPE_WORKTREE:
      -		return "worktree";
      -	case CONFIG_SCOPE_COMMAND:
     @@ -309,7 +310,7 @@
       	printf("origin=%s\n", current_config_origin_type());
       	printf("name=%s\n", current_config_name());
      -	printf("scope=%s\n", scope_name(current_config_scope()));
     -+	printf("scope=%s\n", scope_to_string(current_config_scope()));
     ++	printf("scope=%s\n", config_scope_name(current_config_scope()));
       
       	return 0;
       }
     @@ -323,15 +324,15 @@
       
      +test_expect_success '--show-scope with --list' '
      +	cat >expect <<-EOF &&
     -+		global	user.global=true
     -+		global	user.override=global
     -+		global	include.path=$INCLUDE_DIR/absolute.include
     -+		global	user.absolute=include
     -+		local	user.local=true
     -+		local	user.override=local
     -+		local	include.path=../include/relative.include
     -+		local	user.relative=include
     -+		command	user.cmdline=true
     ++	global	user.global=true
     ++	global	user.override=global
     ++	global	include.path=$INCLUDE_DIR/absolute.include
     ++	global	user.absolute=include
     ++	local	user.local=true
     ++	local	user.override=local
     ++	local	include.path=../include/relative.include
     ++	local	user.relative=include
     ++	command	user.cmdline=true
      +	EOF
      +	git -c user.cmdline=true config --list --show-scope >output &&
      +	test_cmp expect output
     @@ -340,7 +341,7 @@
      +test_expect_success !MINGW '--show-scope with --blob' '
      +	blob=$(git hash-object -w "$CUSTOM_CONFIG_FILE") &&
      +	cat >expect <<-EOF &&
     -+		command	user.custom=true
     ++	command	user.custom=true
      +	EOF
      +	git config --blob=$blob --show-scope --list >output &&
      +	test_cmp expect output
     @@ -348,9 +349,9 @@
      +
      +test_expect_success '--show-scope with --local' '
      +	cat >expect <<-\EOF &&
     -+		local	user.local=true
     -+		local	user.override=local
     -+		local	include.path=../include/relative.include
     ++	local	user.local=true
     ++	local	user.override=local
     ++	local	include.path=../include/relative.include
      +	EOF
      +	git config --local --list --show-scope >output &&
      +	test_cmp expect output
     @@ -358,7 +359,7 @@
      +
      +test_expect_success '--show-scope getting a single value' '
      +	cat >expect <<-\EOF &&
     -+		local	true
     ++	local	true
      +	EOF
      +	git config --show-scope --get user.local >output &&
      +	test_cmp expect output
     @@ -366,15 +367,15 @@
      +
      +test_expect_success '--show-scope with --show-origin' '
      +	cat >expect <<-EOF &&
     -+		global	file:$HOME/.gitconfig	user.global=true
     -+		global	file:$HOME/.gitconfig	user.override=global
     -+		global	file:$HOME/.gitconfig	include.path=$INCLUDE_DIR/absolute.include
     -+		global	file:$INCLUDE_DIR/absolute.include	user.absolute=include
     -+		local	file:.git/config	user.local=true
     -+		local	file:.git/config	user.override=local
     -+		local	file:.git/config	include.path=../include/relative.include
     -+		local	file:.git/../include/relative.include	user.relative=include
     -+		command	command line:	user.cmdline=true
     ++	global	file:$HOME/.gitconfig	user.global=true
     ++	global	file:$HOME/.gitconfig	user.override=global
     ++	global	file:$HOME/.gitconfig	include.path=$INCLUDE_DIR/absolute.include
     ++	global	file:$INCLUDE_DIR/absolute.include	user.absolute=include
     ++	local	file:.git/config	user.local=true
     ++	local	file:.git/config	user.override=local
     ++	local	file:.git/config	include.path=../include/relative.include
     ++	local	file:.git/../include/relative.include	user.relative=include
     ++	command	command line:	user.cmdline=true
      +	EOF
      +	git -c user.cmdline=true config --list --show-origin --show-scope >output &&
      +	test_cmp expect output

-- 
gitgitgadget

  parent reply	other threads:[~2020-01-29  3:34 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  1:11 [PATCH 0/1] config: allow user to know scope of config options Matthew Rogers via GitGitGadget
2019-12-18  1:11 ` [PATCH 1/1] " Matthew Rogers via GitGitGadget
2019-12-18 19:46   ` Junio C Hamano
2019-12-19  5:05     ` Jeff King
2019-12-19 17:51       ` Junio C Hamano
2019-12-18 22:45   ` Philip Oakley
2019-12-19  0:12     ` mattr94
2019-12-19 17:56       ` Junio C Hamano
2019-12-20 22:58         ` Matt Rogers
2019-12-21  2:37           ` Junio C Hamano
2019-12-21  3:08             ` Matt Rogers
2019-12-21 23:47               ` Junio C Hamano
2020-01-09 10:16 ` [PATCH v2 0/4] " Matthew Rogers via GitGitGadget
2020-01-09 10:16   ` [PATCH v2 1/4] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-01-09 19:07     ` Junio C Hamano
2020-01-09 23:22       ` Matt Rogers
2020-01-10 11:55     ` Jeff King
2020-01-09 10:16   ` [PATCH v2 2/4] config: fix config scope enum Matthew Rogers via GitGitGadget
2020-01-09 19:06     ` Junio C Hamano
2020-01-09 23:29       ` Matt Rogers
2020-01-09 10:16   ` [PATCH v2 3/4] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-01-09 19:13     ` Junio C Hamano
2020-01-09 23:41       ` Matt Rogers
2020-01-09 10:16   ` [PATCH v2 4/4] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget
2020-01-09 19:50     ` Junio C Hamano
2020-01-09 23:47       ` Matt Rogers
2020-01-17 15:31   ` [PATCH v3 0/4] config: allow user to know scope of config options Matthew Rogers via GitGitGadget
2020-01-17 15:31     ` [PATCH v3 1/4] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-01-17 15:31     ` [PATCH v3 2/4] config: refine config scope enum Matthew Rogers via GitGitGadget
2020-01-17 20:44       ` Junio C Hamano
2020-01-18 15:27         ` Matt Rogers
2020-01-18 18:09           ` Junio C Hamano
2020-01-17 15:31     ` [PATCH v3 3/4] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-01-17 21:00       ` Junio C Hamano
2020-01-18 15:33         ` Matt Rogers
2020-01-17 15:31     ` [PATCH v3 4/4] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget
2020-01-17 21:21       ` Junio C Hamano
2020-01-17 21:26         ` Bert Wesarg
2020-01-18 15:42         ` Matt Rogers
2020-01-24  0:21     ` [PATCH v4 0/6] config: allow user to know scope of config options Matthew Rogers via GitGitGadget
2020-01-24  0:21       ` [PATCH v4 1/6] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-01-24  0:21       ` [PATCH v4 2/6] t1300: fix over-indented HERE-DOCs Matthew Rogers via GitGitGadget
2020-01-24 18:43         ` Junio C Hamano
2020-01-24  0:21       ` [PATCH v4 3/6] t1300: create custom config file without special characters Matthew Rogers via GitGitGadget
2020-01-24 18:45         ` Junio C Hamano
2020-01-24  0:21       ` [PATCH v4 4/6] config: split repo scope to local and worktree Matthew Rogers via GitGitGadget
2020-01-24 18:49         ` Junio C Hamano
2020-01-24 19:09         ` Junio C Hamano
2020-01-24  0:21       ` [PATCH v4 5/6] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-01-24  0:21       ` [PATCH v4 6/6] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget
2020-01-24 19:18         ` Junio C Hamano
2020-01-24 20:22         ` Junio C Hamano
2020-01-24 20:49           ` Matt Rogers
2020-01-25  0:10             ` Junio C Hamano
2020-01-24 19:22       ` [PATCH v4 0/6] config: allow user to know scope of config options Junio C Hamano
2020-01-25  0:39       ` [PATCH v5 " Matthew Rogers via GitGitGadget
2020-01-25  0:39         ` [PATCH v5 1/6] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-01-25  0:39         ` [PATCH v5 2/6] t1300: fix over-indented HERE-DOCs Matthew Rogers via GitGitGadget
2020-01-25  0:39         ` [PATCH v5 3/6] t1300: create custom config file without special characters Matthew Rogers via GitGitGadget
2020-01-25  0:39         ` [PATCH v5 4/6] config: split repo scope to local and worktree Matthew Rogers via GitGitGadget
2020-01-27 23:09           ` Junio C Hamano
2020-01-25  0:39         ` [PATCH v5 5/6] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-01-25  0:39         ` [PATCH v5 6/6] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget
2020-01-27 23:12           ` Junio C Hamano
2020-01-28  1:31             ` Matt Rogers
2020-01-29  3:34         ` Matthew Rogers via GitGitGadget [this message]
2020-01-29  3:34           ` [PATCH v6 1/6] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-01-29  3:34           ` [PATCH v6 2/6] t1300: fix over-indented HERE-DOCs Matthew Rogers via GitGitGadget
2020-01-29  3:34           ` [PATCH v6 3/6] t1300: create custom config file without special characters Matthew Rogers via GitGitGadget
2020-01-29  3:34           ` [PATCH v6 4/6] config: split repo scope to local and worktree Matthew Rogers via GitGitGadget
2020-01-29  3:34           ` [PATCH v6 5/6] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-01-29  3:34           ` [PATCH v6 6/6] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget
2020-01-29  9:08             ` Bert Wesarg
2020-01-29 23:03               ` Matt Rogers
2020-02-05 19:01                 ` Junio C Hamano
2020-01-29  5:29           ` [PATCH v6 0/6] config: allow user to know scope of config options Junio C Hamano
2020-02-10  0:30           ` [PATCH v7 00/10] " Matthew Rogers via GitGitGadget
2020-02-10  0:30             ` [PATCH v7 01/10] config: fix typo in variable name Matthew Rogers via GitGitGadget
2020-02-10  0:30             ` [PATCH v7 02/10] t1300: fix over-indented HERE-DOCs Matthew Rogers via GitGitGadget
2020-02-10  0:30             ` [PATCH v7 03/10] t1300: create custom config file without special characters Matthew Rogers via GitGitGadget
2020-02-10  0:30             ` [PATCH v7 04/10] config: make scope_name non-static and rename it Matthew Rogers via GitGitGadget
2020-02-10 18:02               ` Junio C Hamano
2020-02-10 21:25                 ` Junio C Hamano
2020-02-11  0:30                 ` Matt Rogers
2020-02-11  1:58                   ` Emily Shaffer
2020-02-11  6:10                   ` Junio C Hamano
2020-02-11 12:37                     ` Matt Rogers
2020-02-10  0:30             ` [PATCH v7 05/10] config: split repo scope to local and worktree Matthew Rogers via GitGitGadget
2020-02-10 18:07               ` Junio C Hamano
2020-02-10  0:30             ` [PATCH v7 06/10] config: clarify meaning of command line scoping Matthew Rogers via GitGitGadget
2020-02-10 18:10               ` Junio C Hamano
2020-02-10  0:30             ` [PATCH v7 07/10] config: preserve scope in do_git_config_sequence Matthew Rogers via GitGitGadget
2020-02-10 18:11               ` Junio C Hamano
2020-02-10  0:30             ` [PATCH v7 08/10] config: teach git_config_source to remember its scope Matthew Rogers via GitGitGadget
2020-02-10 18:14               ` Junio C Hamano
2020-02-10  0:30             ` [PATCH v7 09/10] submodule-config: add subomdule config scope Matthew Rogers via GitGitGadget
2020-02-10 18:15               ` Junio C Hamano
2020-02-10  0:30             ` [PATCH v7 10/10] config: add '--show-scope' to print the scope of a config value Matthew Rogers via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.478.v6.git.1580268865.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mattr94@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).