git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] config: display key_delim for config --bool --get-regexp

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 10, 2011, 20:59 UTC
Message-ID
<7vk48ck1gb.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1318251291-30297-1-git-send-email-Matthieu.Moy@imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 13 quoted lines
> The previous logic in show_config was to print the delimiter when the
> value was set, but Boolean variables have an implicit value "true" when
> they appear with no value in the config file. As a result, we got:
>
> git_Config        --get-regexp '.*\.Boolean'	#1. Ok: example.boolean
> git_Config --bool --get-regexp '.*\.Boolean'	#2. NO: example.booleantrue
>
> Fix this by defering the display of the separator until after the value
> to display has been computed.
>
> Reported-by: Brian Foster <brian.foster@maxim-ic.com>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
Thanks. Will queue for maintenance track.
Show 17 quoted lines
> diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
> index 3e140c1..dffccf8 100755
> --- a/t/t1300-repo-config.sh
> +++ b/t/t1300-repo-config.sh
> @@ -333,6 +333,12 @@ test_expect_success 'get-regexp variable with no value' \
>  	'git config --get-regexp novalue > output &&
>  	 cmp output expect'
>  
> +echo 'novalue.variable true' > expect
> +
> +test_expect_success 'get-regexp --bool variable with no value' \
> +	'git config --bool --get-regexp novalue > output &&
> +	 cmp output expect'
> +
>  echo 'emptyvalue.variable ' > expect
>  
>  test_expect_success 'get-regexp variable with empty value' \

This matches the style of the surrounding code, but we may want to update this to a more modern style.

Previous: Matthieu Moy
Message 4 of 4 in “[BUG 1.7.6.1] `git config --bool --get-regexp' omits separating space... sometimes!”
  1. Brian FosterOct 10, 2011
  2. Matthieu MoyOct 10, 2011
  3. config: display key_delim for config --bool --get-regexpMatthieu Moy, Oct 10, 2011
  4. Junio C HamanoOct 10, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.