config.txt: describe handling of whitespace further
Make it more clear what the whitespace characters are in the context of git configuration files, and significantly improve the description of the leading and trailing whitespace handling, especially how it works out together with the presence of inline comments. Helped-by: Junio C Hamano <gitster@pobox.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Dragan Simic <dsimic@manjaro.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dragan Simic committed
Mar 21, 2024 at 07:06 UTC
e6895c3f971dc4d60f7a9fac6ef41a6593a37ba9
1 file changed
+15
-13
Documentation/config.txt
+15
-13
@@ -22,9 +22,10 @@ multivalued.
22
Syntax
23
~~~~~~
24
25
-The syntax is fairly flexible and permissive; whitespaces are mostly
26
-ignored. The '#' and ';' characters begin comments to the end of line,
27
-blank lines are ignored.
25
+The syntax is fairly flexible and permissive. Whitespace characters,
26
+which in this context are the space character (SP) and the horizontal
27
+tabulation (HT), are mostly ignored. The '#' and ';' characters begin
28
+comments to the end of line. Blank lines are ignored.
29
30
The file consists of sections and variables. A section begins with
31
the name of the section in square brackets and continues until the next
@@ -63,16 +64,17 @@ the variable is the boolean "true").
64
The variable names are case-insensitive, allow only alphanumeric characters
65
and `-`, and must start with an alphabetic character.
66
66
-A line that defines a value can be continued to the next line by
67
-ending it with a `\`; the backslash and the end-of-line are
68
-stripped. Leading whitespaces after 'name =', the remainder of the
69
-line after the first comment character '#' or ';', and trailing
70
-whitespaces of the line are discarded unless they are enclosed in
71
-double quotes. Internal whitespaces within the value are retained
72
-verbatim.
73
-
74
-Inside double quotes, double quote `"` and backslash `\` characters
75
-must be escaped: use `\"` for `"` and `\\` for `\`.
67
+Whitespace characters surrounding `name`, `=` and `value` are discarded.
68
+Internal whitespace characters within 'value' are retained verbatim.
69
+Comments starting with either `#` or `;` and extending to the end of line
70
+are discarded. A line that defines a value can be continued to the next
71
+line by ending it with a backslash (`\`); the backslash and the end-of-line
72
+characters are discarded.
73
+
74
+If `value` needs to contain leading or trailing whitespace characters,
75
+it must be enclosed in double quotation marks (`"`). Inside double quotation
76
+marks, double quote (`"`) and backslash (`\`) characters must be escaped:
77
+use `\"` for `"` and `\\` for `\`.
78
79
The following escape sequences (beside `\"` and `\\`) are recognized:
80
`\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)