Skip to content

Commit ff5507e

Browse files
committed
Documentation/config.txt: describe the structure first and then meaning
A line can be continued via a backquote-LF and can be chomped at a comment character. But that is not specific to string-typed values. It is common to all, just like unquoted leading and trailing whitespaces are stripped and inter-word spacing are retained. Move the description around and desribe these structural rules first, then introduce the double-quote facility as a way to override them, and finally mention various types of values. Note that these structural rules only apply to the value part of the configuration file. E.g. [aSection] \ name \ = value does not work, because the rules kick in only after seeing "name =". Both the original and the updated text are phrased in an awkward way by singling out the "value" part of the line because of this. Signed-off-by: Junio C Hamano <[email protected]>
1 parent a5285b6 commit ff5507e

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

Documentation/config.txt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,32 +59,31 @@ is taken as 'name' and the variable is recognized as boolean "true".
5959
The variable names are case-insensitive, allow only alphanumeric characters
6060
and `-`, and must start with an alphabetic character.
6161

62-
Leading and trailing whitespace in a variable value is discarded.
63-
Internal whitespace within a variable value is retained verbatim.
62+
A line that defines a value can be continued to the next line by
63+
ending it with a `\`; the backquote and the end-of-line are
64+
stripped. Leading whitespaces after 'name =', the remainder of the
65+
line after the first comment character '#' or ';', and trailing
66+
whitespaces of the line are discarded unless they are enclosed in
67+
double quotes. Internal whitespaces within the value are retained
68+
verbatim.
6469

65-
The values following the equals sign in variable assign are all either
66-
a string, an integer, or a boolean. Boolean values may be given as yes/no,
67-
1/0, true/false or on/off. Case is not significant in boolean values, when
68-
converting value to the canonical form using '--bool' type specifier;
69-
'git config' will ensure that the output is "true" or "false".
70-
71-
String values may be entirely or partially enclosed in double quotes.
72-
You need to enclose variable values in double quotes if you want to
73-
preserve leading or trailing whitespace, or if the variable value contains
74-
comment characters (i.e. it contains '#' or ';').
75-
Double quote `"` and backslash `\` characters in variable values must
76-
be escaped: use `\"` for `"` and `\\` for `\`.
70+
Inside double quotes, double quote `"` and backslash `\` characters
71+
must be escaped: use `\"` for `"` and `\\` for `\`.
7772

7873
The following escape sequences (beside `\"` and `\\`) are recognized:
7974
`\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
8075
and `\b` for backspace (BS). No other char escape sequence, nor octal
8176
char sequences are valid.
8277

83-
Variable values ending in a `\` are continued on the next line in the
84-
customary UNIX fashion.
78+
The values following the equals sign in variable assign are all either
79+
a string, an integer, or a boolean. Boolean values may be given as yes/no,
80+
1/0, true/false or on/off. Case is not significant in boolean values, when
81+
converting value to the canonical form using '--bool' type specifier;
82+
'git config' will ensure that the output is "true" or "false".
8583

8684
Some variables may require a special value format.
8785

86+
8887
Includes
8988
~~~~~~~~
9089

0 commit comments

Comments
 (0)