[PATCH 1/3] config.txt: describe whitespace characters further and more accurately
From: Dragan Simic <hidden>
Date: 2024-03-12 15:56:02
Subsystem:
documentation, the rest · Maintainers:
Jonathan Corbet, Linus Torvalds
Make it more clear what the whitespace characters are in the context of git configuration, improve the description of the trailing whitespace handling, and correct the description of the value-internal whitespace handling. Signed-off-by: Dragan Simic <redacted> --- Documentation/config.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 782c2bab906c..4480bb44203b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt@@ -22,9 +22,10 @@ multivalued. Syntax ~~~~~~ -The syntax is fairly flexible and permissive; whitespaces are mostly -ignored. The '#' and ';' characters begin comments to the end of line, -blank lines are ignored. +The syntax is fairly flexible and permissive. Whitespace characters, +which in this context are the space character (SP) and the horizontal +tabulation (HT), are mostly ignored. The '#' and ';' characters begin +comments to the end of line. Blank lines are ignored. The file consists of sections and variables. A section begins with the name of the section in square brackets and continues until the next
@@ -64,12 +65,14 @@ The variable names are case-insensitive, allow only alphanumeric characters and `-`, and must start with an alphabetic character. A line that defines a value can be continued to the next line by -ending it with a `\`; the backslash and the end-of-line are -stripped. Leading whitespaces after 'name =', the remainder of the +ending it with a `\`; the backslash and the end-of-line are stripped. +Leading whitespace characters after 'name =', the remainder of the line after the first comment character '#' or ';', and trailing -whitespaces of the line are discarded unless they are enclosed in -double quotes. Internal whitespaces within the value are retained -verbatim. +whitespace characters of the line are discarded unless they are enclosed +in double quotes. This discarding of the trailing whitespace characters +also applies after the remainder of the line after the comment character +is discarded. Any number of internal whitespace characters found within +the value are converted to the same number of space (SP) characters. Inside double quotes, double quote `"` and backslash `\` characters must be escaped: use `\"` for `"` and `\\` for `\`.