config.txt: document behavior of backslashes in subsections
Unrecognized escape sequences are invalid in values: $ git config -f - --list <<EOF [foo] bar = "\t\\\y\"\u" EOF fatal: bad config line 2 in standard input But in subsection names, the backslash is simply dropped if the following character does not produce a recognized escape sequence: $ git config -f - --list <<EOF [foo "\t\\\y\"\u"] bar = baz EOF foo.t\y"u.bar=baz Although it would be nice for subsection names and values to have consistent behavior, changing the behavior for subsection names is a nonstarter since it would cause existing, valid config files to suddenly be interpreted differently. Signed-off-by: Dave Borowitz <dborowitz@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dave Borowitz committed
Dec 21, 2017 at 08:10 UTC
1feb061701463410647665c4848b6466bf7a97c6
1 file changed
+7
-5
Documentation/config.txt
+7
-5
@@ -41,11 +41,13 @@ in the section header, like in the example below:
41
--------
42
43
Subsection names are case sensitive and can contain any characters except
44
-newline (doublequote `"` and backslash can be included by escaping them
45
-as `\"` and `\\`, respectively). Section headers cannot span multiple
46
-lines. Variables may belong directly to a section or to a given subsection.
47
-You can have `[section]` if you have `[section "subsection"]`, but you
48
-don't need to.
44
+newline and the null byte. Doublequote `"` and backslash can be included
45
+by escaping them as `\"` and `\\`, respectively. Backslashes preceding
46
+other characters are dropped when reading; for example, `\t` is read as
47
+`t` and `\0` is read as `0` Section headers cannot span multiple lines.
48
+Variables may belong directly to a section or to a given subsection. You
49
+can have `[section]` if you have `[section "subsection"]`, but you don't
50
+need to.
51
52
There is also a deprecated `[section.subsection]` syntax. With this
53
syntax, the subsection name is converted to lower-case and is also