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

Re: Confused about git-config's description of escaping

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 3, 2020, 20:15 UTC
Message-ID
<xmqqd047v62u.fsf@gitster.c.googlers.com>
In-Reply-To
<878sevwn0g.fsf@kyleam.com>
Kyle Meyer <kyle@kyleam.com> writes:
Show 34 quoted lines
> When describing the configuration syntax, the git-config manpage says
> this about the value:
>
>     Inside double quotes, double quote " and backslash \ characters must
>     be escaped: use \" for " and \\ for \.
>
> I find the "Inside double quotes" part confusing because escaping these
> characters appears to also be needed when there are no enclosing double
> quotes:
>
>     $ nl .git/config | tail -n2
>          6	[a]
>          7		b = c"d
>
>     $ git config a.b
>     fatal: bad config line 7 in file .git/config
>
>     $ git version
>     git version 2.28.0.236.gb10cc79966
>
> I was going to suggest dropping the "Inside double quotes" qualifier.
> Perhaps
>
>     Double quote " and backslash \ characters in the value must
>     be escaped: use \" for " and \\ for \.
>
> But it looks like that's pretty close to how this sentence was written
> before ff5507ed2a (Documentation/config.txt: describe the structure
> first and then meaning, 2015-03-04), which makes me think that I'm
> misreading the description or otherwise missing something.
>
> What's gained by specifying "Inside double quotes"?  Are there any cases
> where a value, whether enclosed in double quotes or not, doesn't need "
> or \ characters escaped?

Perhaps there is another description missing, either from the written docs or from your reading of it, that says that a value with these characters must be enclosed in double quotes pair?

Previous: Kyle MeyerNext: Kyle Meyer
Message 2 of 3 in “Confused about git-config's description of escaping”
  1. Kyle MeyerAug 3, 2020
  2. Junio C HamanoAug 3, 2020
  3. Kyle MeyerAug 3, 2020

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.