Re: [PATCH v5 08/14] builtin/config: introduce "get" subcommand
From: SZEDER Gábor <hidden>
Date: 2025-08-03 18:19:50
On Mon, May 06, 2024 at 10:56:29AM +0200, Patrick Steinhardt wrote:
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 <redacted> ---
quoted hunk ↗ jump to hunk
@@ -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.