Re: [PATCH v5 08/14] builtin/config: introduce "get" subcommand
- From
SZEDER Gábor <szeder.dev@gmail.com>
- Date
- Aug 3, 2025, 18:19 UTC
- Message-ID
- <aI+oQvQgnNtC6DVw@szeder.dev>
- In-Reply-To
- <29676b81e0151e2982326663f8b64e2a70bec0f8.1714982328.git.ps@pks.im>
On Mon, May 06, 2024 at 10:56:29AM +0200, Patrick Steinhardt wrote:
Show 5 quoted lines
> Introduce a new "get" subcommand to git-config(1). Please refer to > preceding commits regarding the motivation behind this change. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > ---
Show 38 quoted lines
> @@ -519,25 +522,19 @@ you have to provide a regex matching the value of exactly one line.
> To query the value for a given key, do
>
> ------------
> -% git config --get core.filemode
> -------------
> -
> -or
> -
> -------------
> -% git config core.filemode
> +% git config get core.filemode
> ------------
>
> or, to query a multivar:
>
> ------------
> -% git config --get core.gitproxy "for kernel.org$"
> +% git config get --value="for kernel.org$" core.gitproxy
> ------------
>
> If you want to know all the values for a multivar, do:
>
> ------------
> -% git config --get-all core.gitproxy
> +% git config get --all --show-names core.gitproxy
> ------------
>
> If you like to live dangerously, you can replace *all* core.gitproxy by a
> @@ -571,8 +568,8 @@ script:
>
> ------------
> #!/bin/sh
> -WS=$(git config --get-color color.diff.whitespace "blue reverse")
> -RESET=$(git config --get-color "" "reset")
> +WS=$(git config get --type=color --default="blue reverse" color.diff.whitespace)
> +RESET=$(git config get --type=color --default="reset" "")
> echo "${WS}your whitespace color or blue reverse${RESET}"In this example the second command in the postimage doesn't work:
$ RESET=$(git config get --type=color --default="reset" "") error: key does not contain a section:
Consequently, the last command doesn't work as expected anymore, because the color is not reset at the end of the output.
Luckily, the commands in the preimage still work.