{"thread":{"id":"53977","subject":"Confused about git-config's description of escaping","startedAt":"2020-08-03T19:24:53Z","lastAt":"2020-08-03T20:58:46Z","messageCount":3,"participants":["Kyle Meyer","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"402742","messageId":"878sevwn0g.fsf@kyleam.com","threadId":"53977","inReplyTo":null,"subject":"Confused about git-config's description of escaping","fromName":"Kyle Meyer","fromEmail":"kyle@kyleam.com","sentAt":"2020-08-03T19:24:47Z","receivedAt":"2020-08-03T19:24:53Z","isPatch":false,"sender":{"key":"kyle@kyleam.com","avatar":"https://avatars.githubusercontent.com/u/1297788?v=4"},"body":"When describing the configuration syntax, the git-config manpage says\nthis about the value:\n\n    Inside double quotes, double quote \" and backslash \\ characters must\n    be escaped: use \\\" for \" and \\\\ for \\.\n\nI find the \"Inside double quotes\" part confusing because escaping these\ncharacters appears to also be needed when there are no enclosing double\nquotes:\n\n    $ nl .git/config | tail -n2\n         6\t[a]\n         7\t\tb = c\"d\n\n    $ git config a.b\n    fatal: bad config line 7 in file .git/config\n\n    $ git version\n    git version 2.28.0.236.gb10cc79966\n\nI was going to suggest dropping the \"Inside double quotes\" qualifier.\nPerhaps\n\n    Double quote \" and backslash \\ characters in the value must\n    be escaped: use \\\" for \" and \\\\ for \\.\n\nBut it looks like that's pretty close to how this sentence was written\nbefore ff5507ed2a (Documentation/config.txt: describe the structure\nfirst and then meaning, 2015-03-04), which makes me think that I'm\nmisreading the description or otherwise missing something.\n\nWhat's gained by specifying \"Inside double quotes\"?  Are there any cases\nwhere a value, whether enclosed in double quotes or not, doesn't need \"\nor \\ characters escaped?\n"},{"id":"402748","messageId":"xmqqd047v62u.fsf@gitster.c.googlers.com","threadId":"53977","inReplyTo":"878sevwn0g.fsf@kyleam.com","subject":"Re: Confused about git-config's description of escaping","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-08-03T20:15:53Z","receivedAt":"2020-08-03T20:16:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kyle Meyer <kyle@kyleam.com> writes:\n\n> When describing the configuration syntax, the git-config manpage says\n> this about the value:\n>\n>     Inside double quotes, double quote \" and backslash \\ characters must\n>     be escaped: use \\\" for \" and \\\\ for \\.\n>\n> I find the \"Inside double quotes\" part confusing because escaping these\n> characters appears to also be needed when there are no enclosing double\n> quotes:\n>\n>     $ nl .git/config | tail -n2\n>          6\t[a]\n>          7\t\tb = c\"d\n>\n>     $ git config a.b\n>     fatal: bad config line 7 in file .git/config\n>\n>     $ git version\n>     git version 2.28.0.236.gb10cc79966\n>\n> I was going to suggest dropping the \"Inside double quotes\" qualifier.\n> Perhaps\n>\n>     Double quote \" and backslash \\ characters in the value must\n>     be escaped: use \\\" for \" and \\\\ for \\.\n>\n> But it looks like that's pretty close to how this sentence was written\n> before ff5507ed2a (Documentation/config.txt: describe the structure\n> first and then meaning, 2015-03-04), which makes me think that I'm\n> misreading the description or otherwise missing something.\n>\n> What's gained by specifying \"Inside double quotes\"?  Are there any cases\n> where a value, whether enclosed in double quotes or not, doesn't need \"\n> or \\ characters escaped?\n\nPerhaps there is another description missing, either from the\nwritten docs or from your reading of it, that says that a value with\nthese characters must be enclosed in double quotes pair?\n\n"},{"id":"402755","messageId":"874kpjwinx.fsf@kyleam.com","threadId":"53977","inReplyTo":"xmqqd047v62u.fsf@gitster.c.googlers.com","subject":"Re: Confused about git-config's description of escaping","fromName":"Kyle Meyer","fromEmail":"kyle@kyleam.com","sentAt":"2020-08-03T20:58:42Z","receivedAt":"2020-08-03T20:58:46Z","isPatch":false,"sender":{"key":"kyle@kyleam.com","avatar":"https://avatars.githubusercontent.com/u/1297788?v=4"},"body":"Junio C Hamano writes:\n\n> Kyle Meyer <kyle@kyleam.com> writes:\n[...]\n>> What's gained by specifying \"Inside double quotes\"?  Are there any cases\n>> where a value, whether enclosed in double quotes or not, doesn't need \"\n>> or \\ characters escaped?\n>\n> Perhaps there is another description missing, either from the\n> written docs or from your reading of it, that says that a value with\n> these characters must be enclosed in double quotes pair?\n\nThanks for the reply.\n\nI'm not spotting anything in the current git-config documentation that\nsays that.  And it would be an incorrect description of the syntax,\nwouldn't it?  When entering a value containing a quote with 'git\nconfig', enclosing double quotes aren't inserted:\n\n    $ git config a.b 'c\"d'\n    $ tail -n2 .git/config\n    [a]\n    \tb = c\\\"d\n    $ git config a.b\n    c\"d\n\nSo, it seems valid for a value to have these characters escaped without\nhaving them enclosed in a pair of double quotes.\n"}]}