git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* Confused about git-config's description of escaping
@ 2020-08-03 19:24 Kyle Meyer
  2020-08-03 20:15 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Kyle Meyer @ 2020-08-03 19:24 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Confused about git-config's description of escaping
  2020-08-03 19:24 Confused about git-config's description of escaping Kyle Meyer
@ 2020-08-03 20:15 ` Junio C Hamano
  2020-08-03 20:58   ` Kyle Meyer
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2020-08-03 20:15 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: git

Kyle Meyer <kyle@kyleam.com> writes:

> 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?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Confused about git-config's description of escaping
  2020-08-03 20:15 ` Junio C Hamano
@ 2020-08-03 20:58   ` Kyle Meyer
  0 siblings, 0 replies; 3+ messages in thread
From: Kyle Meyer @ 2020-08-03 20:58 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano writes:

> Kyle Meyer <kyle@kyleam.com> writes:
[...]
>> 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?

Thanks for the reply.

I'm not spotting anything in the current git-config documentation that
says that.  And it would be an incorrect description of the syntax,
wouldn't it?  When entering a value containing a quote with 'git
config', enclosing double quotes aren't inserted:

    $ git config a.b 'c"d'
    $ tail -n2 .git/config
    [a]
    	b = c\"d
    $ git config a.b
    c"d

So, it seems valid for a value to have these characters escaped without
having them enclosed in a pair of double quotes.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-03 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 19:24 Confused about git-config's description of escaping Kyle Meyer
2020-08-03 20:15 ` Junio C Hamano
2020-08-03 20:58   ` Kyle Meyer

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git